user269867
user269867

Reputation: 3972

Lumen Dingo php artisan command error

I have installed Lumen, Dingo to test the JWT integration.

On terminal when I try to run unit test case using php artisan command it throws following error

PHP Fatal error:  Call to undefined function Dingo\Api\Provider\config_path() in /usr/local/var/www/vhosts/storm/vendor/dingo/api/src/Provider/LaravelServiceProvider.php on line 26
PHP Stack trace:
PHP   1. {main}() /usr/local/var/www/vhosts/xxx/artisan:0
PHP   2. require() /usr/local/var/www/vhosts/xxx/artisan:18
PHP   3. Laravel\Lumen\Application->register() /usr/local/var/www/vhosts/storm/bootstrap/app.php:84
PHP   4. Illuminate\Container\Container->call() /usr/local/var/www/vhosts/storm/vendor/laravel/lumen-framework/src/Application.php:176
PHP   5. Illuminate\Container\BoundMethod::call() /usr/local/var/www/vhosts/storm/vendor/illuminate/container/Container.php:531
PHP   6. Illuminate\Container\BoundMethod::callBoundMethod() /usr/local/var/www/vhosts/storm/vendor/illuminate/container/BoundMethod.php:31
PHP   7. Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() /usr/local/var/www/vhosts/storm/vendor/illuminate/container/BoundMethod.php:87
PHP   8. call_user_func_array:{/usr/local/var/www/vhosts/storm/vendor/illuminate/container/BoundMethod.php:30}() /usr/local/var/www/vhosts/storm/vendor/illuminate/container/BoundMethod.php:30
PHP   9. Dingo\Api\Provider\LaravelServiceProvider->boot() /usr/local/var/www/vhosts/storm/vendor/illuminate/container/BoundMethod.php:30

My composer.json:

"laravel/lumen-framework": "5.4.*",
"vlucas/phpdotenv": "~2.2",
"dingo/api": "1.0.*@dev",
"guzzlehttp/guzzle": "^6.2",
"lukasoppermann/http-status": "^2.0"

Any php artisan command is throwing above error.

Upvotes: 0

Views: 237

Answers (1)

codedge
codedge

Reputation: 5174

I can only suspect that you registered the LaravelServiceProvider instead of using the LumenServiceProvider. As Lumen does not have the helper function config_path() you're getting this error.

So according to the install instructions you should add

$app->register(Dingo\Api\Provider\LumenServiceProvider::class);

to your bootstrap/app.php.

Upvotes: 1

Related Questions