Coexistance problem with laravel-ide-helper
Hi,
I started testing PhpStorm yesterday and to have intellisense I installed barryvdh/laravel-ide-helper. Here what's happened:
created a new laravel project, added "'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',", ran composer update, added "php artisan ide-helper:generate", ran composer update, got the db error message about the user 'forge', created a database and updated 'database.php', ran composer update everything's fine.
added a model, a view, a controller, ran composer update, so far, so good.
done a few php artisan command with no problem.
added ollieread/multiauth, ran composer update, boom bada boom,
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Ollieread\Multiauth\MultiauthServiceProvider' not found","file":"C:...\storm_test\test_storm\bootstrap\compiled.php","line":4217}}Script php artisan clear-compiled handling the post-update-cmd event returned with an error
tried a php command, typically php artisan --version
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Ollieread\Multiauth\MultiauthServiceProvider' not found","file":"C:...\storm_test\test_storm\bootstrap\compiled.php","line":4217}}
So clearly there's a problem between barryvdh/laravel-ide-helper and ollieread/multiauth.
Do you have any idea?
Did you modify config/app.php before installing the package?
When I add multiauth (which is a must have for me, thanks for it) I strictly follow your instructions:
- update composer.json
- replace authserviceprovider by multiauthserviceprovider in config/app.php
- update config/auth.php (I do not use the reminders.)
- run composer update.
Well, composer it is telling you there is no package in the "compiled" files, did you cleaned your autoload_real?
composer dump-autoload -o php artisan dump-autoload
and run again composer update this time with "-v" to see what is composer doing.
I had done the dump-autoload. Did it again and composer update and artisan ide-help:generate and got again:
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to a member function getProvider() on a non-object","file":"C:...\vendor\laravel\framework\src\Illuminate\Auth\Reminders\ReminderServiceProvider.php","line":46}}
As you can see, seems Ollie's Auth is now loadad, now your error it is on the Reminders, Laravel it is trying to get the Auth native ones,
Try adding the package reminders (anyways you'll need them later).
Important: the Multi Auth Service providers && Remiders "replaces" the existent ones, ("Illuminate\Auth\AuthServiceProvider" && "Illuminate\Auth\Reminders\ReminderServiceProvider")
Sorry to remark, but it is really important and would save you hours of trying.. ;)
Yeah, the problem isn't with the ide helper, it's the configuration, which seems to be a rather large point for issues, I should amend the documentation.
Hi guys,
Thanks for the help. You are right, I replaced 'Illuminate\Auth\Reminders\ReminderServiceProvider' by 'Ollieread\Multiauth\Reminders\ReminderServiceProvider' and no more errors. So definitely you should amend the documentation.
@mikeshow Which bit of the documentation is misleading by the way?
You said that yourself, I presumed about the fact that we should replace the reminders provider too.
Well... thats only if you are using integrated Laravel Reminder, sometimes (considerable), you rather prefer to use another reminder process within Laravel, thats why he says in the documentation: "If you wish to use reminders, you will need to replace ReminderServiceProvider in you app/config/app.php file with the following."
And if you do, you'll need then to setup the mails issues too, and address it in your own implementation. The only thing i'll change to the documentation is put in BOLD AND HUGE, "REPLACE SERVICEPROVIDERS", the most of the issues i've seen here it is just for that, nobody reads...
I am going to add to the documentation saying that if you don't play to use reminders at all, remove the service provider for the default.
That said, the problem occurs to me because I switched to PhpStorm and installed the laravel-ide-help. Other than that it should not be a problem. So maybe just a warning that if one use a package like laravel-ide-help which scans all the installed packages to provide intellisense you could have an error.
The issue is nothing to do with laravel-ide-helper, would have had the same issue had you not used that.
Yes it has! I have used your package for months with no problem at all, but I was developing with visual studio and I am using a bunch of other packages. Tuesday when I got to know about PhpStorm, to test, I moved a big project with no problem. It's solely when I installed laravel-ide-help to get intellisense that I got the issue. So the issue is with packages doing the same kind of things as laravel-ide-help.
I've taken a look through the code for laravel-id-helper, and as originally thought, there's absolutely nothing within that package that would conflict with this. Also, the errors that you reported above, the ones that prompted the creation of this github issue are related to misconfiguration, which is evident by the fact that you fixed it by changing the configuration.
@mikeshow If you're adamant that there's an issue, please recreate the issue in a fresh project and provide every step you took to create the error.
I think there's a bit of misunderstanding here if I judge by your tone.
I never, ever, said that there is an issue in any of the packages, and I said it earlier, your package is fantastic and it should be part of Laravel. Individually they work just fine. The issue, if we consider it an issue, being (and you said it yourself) that the documentation should be amended. In the readme you write: "If you wish to use reminders, you will need to replace ReminderServiceProvider in you[r] app/config/app.php file". In my case I don't use reminders, so according to the documentation I didn't feel the need to replace "ReminderServiceProvider". And so far, using multiauth for months with numeros packages, everything worked like a charm.
If you felt offended in anyway, my apology, there's no issue with the package. You just need to modify the readme so that instead of writing "if you wish..." you should write "you must also replace ReminderServiceProvider" which would avoid you, now, telling me that it's because of a misconfiguration.