I'm using Laravel 4.2. I have a custom ServiceProvider that is registered in app.php. My code wasn't working the way I expected, so I added a syntax error to my service provider file to see if it was loading.
Turns out, it's not loading when I access my site via the web - the syntax error never gets thrown. But if I run a phpunit test, phpunit experiences the syntax error. Yes, I've run composer dump-auto.
What am I missing? I'm not getting a "can't find file" error - I'm not getting any errors at all, which mean it's not loading the file.
The ServiceProvider is located at /app/providers/myorg/MyOrgServiceProvider.php
.
/vendor/composer/autoload_classmap.php
is also showing it correctly: 'MyOrg\\ServiceProvider\\MyOrgServiceProvider' => $baseDir . '/app/providers/myorg/MyOrgServiceProvider.php',
//composer.json
"autoload": {
"classmap": [
//...all the other autoload files,
"app/providers"
]
},
// /config/app.php
'providers' => array(
'MyOrg\ServiceProvider\MyOrgServiceProvider',
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
//....all the other providers
)
///app/providers/myorg/MyOrgServiceProvider.php
namespace MyOrg\ServiceProvider;
use Illuminate\Support\ServiceProvider;
asdf //the forced syntax error
class MyOrgServiceProvider extends ServiceProvider {
public function register() {
//...all the binding info
}
}
Could be a bad meta-data cache, try artisan clear-compiled or you can just delete the file storage/meta/services.json, or change the order of the providers array and it will update the cache on the next run.
TerrePorter said:
Could be a bad meta-data cache, try artisan clear-compiled or you can just delete the file storage/meta/services.json, or change the order of the providers array and it will update the cache on the next run.
Tried artisan clear-compiled
and tried deleting the storage/meta/services.json
file - neither one worked. The services.json file wouldn't put my custom service provider in.
Putt the service provider in at the bottom of the providers instead of the top did work, thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community