orchestra / config
Configuration Component for Laravel and Orchestra Platform
Requires
- php: ^7.3 || ^8.0
- illuminate/filesystem: ^8.0
- orchestra/contracts: ^6.0
- dev-master / 7.0.x-dev
- 6.x-dev
- v6.0.0
- 5.x-dev
- v5.1.0
- v5.0.0
- 4.x-dev
- v4.3.0
- v4.2.0
- v4.1.0
- v4.0.1
- v4.0.0
- 3.8.x-dev
- v3.8.4
- v3.8.3
- v3.8.2
- v3.8.1
- v3.8.0
- 3.7.x-dev
- v3.7.1
- v3.7.0
- 3.6.x-dev
- v3.6.2
- v3.6.1
- v3.6.0
- v3.6.0-BETA1
- 3.5.x-dev
- v3.5.3
- v3.5.2
- v3.5.1
- v3.5.0
- 3.4.x-dev
- v3.4.4
- v3.4.3
- v3.4.2
- v3.4.1
- v3.4.0
- v3.4.0-BETA2
- v3.4.0-BETA1
- 3.3.x-dev
- v3.3.6
- v3.3.5
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.16
- v3.1.15
- v3.1.14
- v3.1.13
- v3.1.12
- v3.1.11
- v3.1.10
- v3.1.9
- v3.1.8
- v3.1.7
- v3.1.6
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
This package is auto-updated.
Last update: 2024-09-18 21:20:02 UTC
README
Config Component is a configuration with environment based support for Laravel 5 and above. The component is actually based from Laravel 4 configuration.
Table of Content
Version Compatibility
Installation
To install through composer, run the following command from terminal:
composer require "orchestra/config"
Configuration
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 );
Configuration Caching Support
Config Component also bring an enhanced php artisan config:cache
support to speed up configuration loading, some features include:
- Caching packages/namespaced config instead of just application
config
directory. - Enforcing lazy loaded packages config by including list of packages config key in
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
.
Caching lazy loaded packages file
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" ], ];