To publish Pennant's configuration and migration files in a Laravel application, follow these detailed steps:
1. Install Laravel Pennant Package
Use Composer to install the Laravel Pennant package into your Laravel project by running:
composer require laravel/pennant
2. Publish Configuration and Migration Files
After installation, you need to publish Pennant's configuration and migration files to your application's directories. Use the Artisan vendor:publish command with the Pennant service provider specified:
php artisan vendor:publish --provider="Laravel\Pennant\PennantServiceProvider"
This command will create two files in your project:
- `config/pennant.php` - the configuration file where you can set the default storage driver for feature flags.
- A migration file in `database/migrations/` that creates the `features` table used by Pennant for storing feature flags persistently.
3. Run Database Migrations
To apply the migration and create the necessary database table, run:
php artisan migrate
This will create the `features` table in your database, which Pennant uses by default to store feature flag values.
4. Configure Pennant (Optional)
After publishing, you can customize the `config/pennant.php` file to specify the storage driver for feature flags. By default, Pennant uses the `database` driver, but it also supports an in-memory `array` driver for temporary storage.
These steps ensure that Pennant is properly set up with its configuration and database migration files published and ready for use in your Laravel application[1][2][3][9].
Citations:
[1] https://wpwebinfotech.com/blog/laravel-pennant-guide/
[2] https://redberry.international/laravel-pennant-feature-flagging-made-easy/
[3] https://www.honeybadger.io/blog/a-guide-to-feature-flags-in-laravel/
[4] https://www.linkedin.com/pulse/why-laravel-pennant-help-you-roll-out-features-ease-mabugay-trxtc
[5] https://stackoverflow.com/questions/36316259/publishing-config-and-migrations-from-included-package-in-laravel
[6] https://atlasgo.io/versioned/apply
[7] https://help.benchling.com/hc/en-us/articles/23506127164301-Configuration-Migration
[8] https://platform.veevavault.help/en/lr/36919/
[9] https://laravel.com/docs/11.x/pennant
[10] https://support.psigen.com/hc/en-us/articles/360047786791-PSIcapture-Administrator-Guide-General-Migration-Configuration