Configs
Configs
Configs is a special case. If the configuration of the package is relevant for other packages, or you control bootraiser via config-array, use the register-method to load the config and then all other software components in the boot-method.
Laravel package config
<?php
namespace YourCompany\YourPackage\Providers;
use Filefabrik\Bootraiser\Raiser;
use Illuminate\Support\ServiceProvider;
class YourPackageServiceProvider extends ServiceProvider
{
public function register(): void
{
// never forget parent call!
parent::register();
Raiser::forProvider($this)->loadConfigs();
//Your package configuration can now be read and changed by other packages.
}
public function boot(): void
{
Raiser::forProvider($this)->runFromArray(config('your-package.bootraiser'));
}
}
ℹ️
All files from the package ./config folder are used in bootraiser.
Structure
- your-package.php
- your-package-maybe-extra-config.php
ℹ️
Package configs are published and loaded exactly as they are named in the config package folder
Possible instructions
with method
Raiser::forProvider($this)->Configs();
Raiser::forProvider($this)->loadConfigs();
Raiser::forProvider($this)->publishConfigs();
with array
['Configs']
['loadConfigs']
['publishConfigs']
publish command
vendor publish suggestion
php artisan vendor:publish
vendor publish –tag
php artisan vendor:publish --tag=your-package-configs
References
Last updated on