Lumen php artisan config:cache not found

非 Y 不嫁゛ 提交于 2019-12-07 01:33:55

问题


I'm trying out the PHP micro Framework Lumen (from laravel). When I set up Lumen and I try to use the php artisan config:cache command like in Laravel, I get this error :

[InvalidArgumentException]
There are no commands defined in the "config" namespace.

So I have problem when I try to deploy the files to server, so I have to change .env file to change the database username and password.

This makes me think config is not available in artisan

How can I add it to artisan ?


回答1:


Yes, you can not use the php artisan config:cache with your Lumen project, because it is not available out of the box.

You can add it by adding this package (orumad/lumen-config-cache) to your project:

composer require orumad/lumen-config-cache



回答2:


In lumen you have to add this configuration in bootstrap/app.php file

$app->configure('custom_config_file_name');

#example
$app->configure('custom_emails');

Then you can access like below:

config('filename.key_name');

#example
config('constants.email');


来源:https://stackoverflow.com/questions/34579725/lumen-php-artisan-configcache-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!