2

So according to this answer the only way to add service providers is to first run composer update and composer install.

This becomes a problem in terms of automation, as the service provider has already been added to config/app.php in the code repo.

'providers' => [
    ....
    App\Providers\RouteServiceProvider::class,

    /** Forum **/
    'Riari\Forum\ForumServiceProvider',
    'Riari\Forum\Frontend\ForumFrontendServiceProvider',

],

So running composer update and composer install fails with:

[RuntimeException] Error Output: PHP Fatal error: Class 'Riari\Forum\Frontend\ForumFrontendServiceProvider' not found in /repo/myshares/myshares/bootstrap/cache/compiled.php on line 6892

As far as I can see the only way is to run composer update first and then manually add to config/app.php

Community
  • 1
  • 1
tread
  • 10,133
  • 17
  • 95
  • 170

1 Answers1

3

Just run your composer install or composer update with the parameter --no-scripts.

composer install --no-scripts
composer update --no-scripts

Laravel will run a few commands before installing or updating, that use the artisan script which will throw this error at you because it initiates a Laravel instance.

After composer has run you can always manually run the artisan commands (in this case php artisan clear-compiled).

Tim
  • 5,893
  • 3
  • 35
  • 64