2017 © Pedro PelĂĄez
 

library lumen-config-cache

Adds the Laravel command `php artisan config:cache` to Lumen

image

orumad/lumen-config-cache

Adds the Laravel command `php artisan config:cache` to Lumen

  • Friday, November 3, 2017
  • by orumad
  • Repository
  • 1 Watchers
  • 3 Stars
  • 465 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 151 % Grown

The README.md

lumen-config-cache

Latest Version on Packagist Total Downloads License: MIT, (*1)

Adds the Laravel artisan command config:cache to Lumen., (*2)

Once installed you can type php artisan lumen-config:cache in your console to gets all your Lumen configuration files loaded in the cache, which will increase your Lumen app response times., (*3)

Installation

This package can be used in Laravel 5.4 or higher with PHP 7.0 or higher., (*4)

You can install the package via composer:, (*5)

composer require orumad/lumen-config-cache

Now register the service provider in bootstrap/app.php file:, (*6)

$app->register(Orumad\ConfigCache\ServiceProviders\ConfigCacheServiceProvider::class);

If you want to publish automatically the config file, you must install a package like lumen-vendor-publish, which contains a single command that enables you to publish a package config file to the config folder of your Lumen application., (*7)

So you can publish the config file like in Laravel:, (*8)

php artisan vendor:publish --tag="lumen-config-cache"

If you dedice to not install any aditional package, then you can copy the file vendor/orumad/lumen-config-cache/src/config/config-cache.php to your app config folder., (*9)

This is the contents of the published config/config-cache.php config file:, (*10)

return [

    /**
     * The name of the key where the config is stored in cache
     */
    'cache_key' => 'config_cache',

    /**
     * Expiration time for the config in cache
     */
    'cache_expiration_time' => 60*24, // One day

    /**
     * The config files (app, database, queue, etc.) to be cached
     * Add to this array whatever config files you want to load in cache
     */
    'config_files' => [
        'app',
    ],

];

You should enable the use of facades in Lumen uncommenting the following line in your bootstrap/app.php file:, (*11)

``` php // $app->withFacades();, (*12)




## Usage You can access your config keys with `ConfigCache::get` facade method: ``` php use Orumad\ConfigCache\Facades\ConfigCache; ... $api_url = ConfigCache::get('app.API_URL');

Also you can force the cached config to be refreshed with ConfigCache::refresh facade method:, (*13)

``` php, (*14)

use Orumad\ConfigCache\Facades\ConfigCache;, (*15)

..., (*16)

ConfigCache::refresh();, (*17)



You can use the `artisan` command `lumen-config:cache` to force the cached configuration to be refreshed too. **TIP: Add this command to your deployment script to be sure you have the last config cached after deploy your new app release:** ``` bash php artisan lumen-config:cache

Change log

Please see CHANGELOG for more information what has changed recently., (*18)

Contributing

Please see CONTRIBUTING for details., (*19)

Security

If you discover any security related issues, please email dev@danielmunoz.io instead of using the issue tracker., (*20)

Credits

License

The MIT License (MIT). Please see License File for more information., (*21)

The Versions

03/11 2017

dev-master

9999999-dev https://github.com/orumad/lumen-config-cache

Adds the Laravel command `php artisan config:cache` to Lumen

  Sources   Download

MIT

The Requires

 

by Daniel Muñoz

laravel laravel-5-package orumad lumen-config-cache

03/11 2017

1.0.1

1.0.1.0 https://github.com/orumad/lumen-config-cache

Adds the Laravel command `php artisan config:cache` to Lumen

  Sources   Download

MIT

The Requires

 

by Daniel Muñoz

laravel laravel-5-package orumad lumen-config-cache

25/07 2017

1.0.0

1.0.0.0 https://github.com/orumad/lumen-config-cache

Adds the Laravel command `php artisan config:cache` to Lumen

  Sources   Download

MIT

The Requires

 

by Daniel Muñoz

laravel laravel-5-package orumad lumen-config-cache