Package Data | |
---|---|
Maintainer Username: | crynobone |
Maintainer Contact: | taylorotwell@gmail.com (Taylor Otwell) |
Package Create Date: | 2014-12-09 |
Package Last Update: | 2021-04-18 |
Home Page: | https://github.com/orchestral/kernel |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:18:02 |
Package Statistics | |
---|---|
Total Downloads: | 9,069 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 5 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Config Component is a configuration with environment based support for Laravel 5 and above. The component is actually based from Laravel 4 configuration.
Laravel | Config :----------|:---------- 5.5.x | 3.5.x 5.6.x. | 3.6.x 5.7.x. | 3.7.x 5.8.x | 3.8.x@dev
To install through composer, simply put the following in your composer.json
file:
{
"require": {
"orchestra/config": "^3.5"
}
}
And then run composer install
from the terminal.
Above installation can also be simplify by using the following command:
composer require "orchestra/config=^3.5"
To swap Laravel 5 default configuration, all you need to do is add the following code to bootstrap/app.php
:
$app->singleton(
Illuminate\Foundation\Bootstrap\LoadConfiguration::class,
Orchestra\Config\Bootstrap\LoadConfiguration::class
);
Config Component also bring an enhanced php artisan config:cache
support to speed up configuration loading, some features include:
config
directory.compile.config
.In order to do this you need to replace Illuminate\Foundation\Provider\ArtisanServiceProvider
with a new App\Providers\ArtisanServiceProvider
:
<?php namespace App\Providers;
use Orchestra\Config\Console\ConfigCacheCommand;
use Illuminate\Foundation\Providers\ArtisanServiceProvider as ServiceProvider;
class ArtisanServiceProvider extends ServiceProvider
{
/**
* Register the command.
*
* @return void
*/
protected function registerConfigCacheCommand()
{
$this->app->singleton('command.config.cache', function ($app) {
return new ConfigCacheCommand($app['files']);
});
}
}
Don't forget to update your
config/app.php
to replacesIlluminate\Foundation\Provider\ArtisanServiceProvider
withApp\Providers\ArtisanServiceProvider
.
In order to force certain packages to be included in config caching, you can specify either the relative key of desired packages in your config/compile.php
file:
<?php
return [
// ...
'config' => [
'orchestra/foundation::config', // if package config is group under "config/config.php"
'orchestra/foundation::roles', // Using one of the key available in "config/config.php"
'orchestra/html::form', // When package contain "config/form.php"
],
];