Laravel "Class not found ..." when running wizards (but not composer)
I have an application that I have been working on for several weeks; I use Vagrant + Homestead for local development and Forge + Linode for staging; so far a few days ago my workflow was working fine, however now when the deploy script is done in Forge (specifically composer install
) it gets the error:
[RuntimeException] Error Output: PHP Fatal error: Class 'Reputationhub\ReputationhubServiceProvider' not found in /home/vagrant/Sites/reputationhu b/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157 PHP Stack trace: PHP 1. {main}() /home/vagrant/Sites/reputationhub/artisan:0 PHP 2. require_once() /home/vagrant/Sites/reputationhub/artisan:30 PHP 3. require() /home/vagrant/Sites/reputationhub/bootstrap/start.php:60 PHP 4. Illuminate\Foundation\ProviderRepository->load() /home/vagrant/Sites/reputationhub/vendor/laravel/framework/src/Illumin ate/Foundation/start.php:210 PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() /home/vagrant/Sites/reputationhub/vendor/laravel/framework/ src/Illuminate/Foundation/ProviderRepository.php:57 PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() /home/vagrant/Sites/reputationhub/vendor/laravel/framework/s rc/Illuminate/Foundation/ProviderRepository.php:121
This is actually a subcommand php artisan clear-compiled
that the composer runs after that, which fails. If I run this on my account, then the same problem. Execution composer install --no-script
is fine. When I look at vendor/composer/autoload_classmap.php
it skips all sorts of things and is only a few lines long (usually a lot longer), so no matter what Laravel does, finding the right classes is wrong.
The odd thing is that the launch composer dump-autoload -o
seems to fix it; the file autoload_classmap.php
finds everything and the application runs fine until php artisan ...
it tries to do something, then it crashes the application.
The end result is that Forge deployment is broken; I can manually go to the server and run composer dump-autoload -o
to fix this, but it seems to be wrong.
I think I'm pretty thorough with the solutions, but can't seem to find anything yet, so any help would be appreciated.
UPDATE: further clarification
This is Laravel 4.2.
My composer.json
startup section looks like this:
...
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-4": {
"Reputationhub\\": "app/"
},
"files": []
},
...
The supplier has been added to the "suppliers" array app.php
as follows:
...
'Reputationhub\ReputationhubServiceProvider',
...
And my provider's file (at app/Reputationhub/ReputationhubServiceProvider.php
) looks like this:
<?php namespace Reputationhub;
use Reputationhub\EventSubscribers\MetricsEventSubscriber;
use Illuminate\Support\ServiceProvider;
class ReputationhubServiceProvider extends ServiceProvider {
...
}
Update 2: more testing
Not sure what it does, but composer install
it seems to be doing something bad that breaks the application. To fix this, instead of using composer install
a script in the deployment (which will subsequently call php artisan clear-compiled
and php artisan optimize
, both of which will throw errors), if I use that, it will restore itself:
... composer install --no-scripts composer dump-autoload -o php artisan dump-autoload ...
source to share
No one has answered this question yet
Check out similar questions: