This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Vojta Svoboda
Vojta Svoboda

When using own service in /config/app.php:

'providers' => array_merge(include(base_path().'/modules/system/providers.php'), [
    'System\ServiceProvider',
    'Jenssegers\Agent\AgentServiceProvider',
]),

...and fire project update at Backend, it fails with:

October update fails

And than whole application crash:

Mon Nov  2 11:40:56 2015] PHP Fatal error:  Class 'Jenssegers\Agent\AgentServiceProvider' not found in /Users/VojtaSvoboda/Www/mysite.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 150

Tested on Jenssegers\Agent and Intervention\Image and same problem. It fails only when updating system, no when updating plugins. After crash - only what helps is composer update.

Anyone with same problem or some solution? One way is encapsulate 3th party services to special plugin, but i think it should works independently.

Daniel81
Daniel81

Try loading/adding the service provider in your actual plugin itself so it's all contained within the plugin rather than in your app.php - in your plugin boot() method you can use

App::register('Jenssegers\Agent\AgentServiceProvider');

then you can use use Jenssegers\Agent\Agent; in your plugin.

Where is your composer.json file, within your plugin directory or elsewhere?

daftspunky
daftspunky

If you use composer it is a good idea to disable core updates and update using composer instead. You should still receive plugins updates.

See config/cms.php

Vojta Svoboda
Vojta Svoboda

Thank you guys, both solutions are working well!

jvanremoortere
jvanremoortere

I'm getting this error while my serviceprovider IS loaded in my plugin... Everything works just fine locally but when pushing to production I get :

Class 'Vinkla\Hashids\HashidsServiceProvider' not found ../vendor/laravel/framework/src/Illuminate/Foundation/Application.php line 575

jvanremoortere
jvanremoortere

Ok I fixed it... HashidsServiceProvider 3.1 doesn't support laravel 5.1 :) downgraded to 2.4...

My bad :)

jvanremoortere
jvanremoortere

now it works but artisan is messed up... When I try to refresh a plugin I get [Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Vinkla\Hashids\HashidsServiceProvider' not found

1-7 of 7

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.