Missing 'Illuminate\Routing\ControllerServiceProvider' class on Laravel 5.2 - php

I have updated the composer.json file as instructed on the upgrade guide on Laravel 5.2 Documentation and run composer update.
Everything was updated correctly, but composer dumped the error below while generating autoload files.
Class 'Illuminate\Routing\ControllerService Provider' not found in /home/vagrant/Code/homework/vendor/laravel/framework /src/Illuminate/Foundation/ProviderRepository.php on line 146

Make sure you remove Illuminate\Routing\ControllerServiceProvider from your /config/app.php.
https://www.laravel.com/docs/5.2/upgrade (see the "Service Providers" section)

Problem is with your composer.json.It may got corrupted. Make sure
"require": {
"laravel/framework": "5.2.*"
},
exists.Then run composer update.

Related

laravel-spark-google2fa Provider class not found after Spark update to v9.0

I recently updated a Laravel/Spark web application to the latest version of Spark (v9.*) via composer. Another package I use is Laravel-Spark-Google2FA which I also updated from v1.* to v2.*.
Setup:
The laravel-spark-google2fa package has a Laravel service provider class that resides in /project-root/laravel/spark/src/Providers/Google2FAServiceProvider.php
In Laravel we specify this in /project-root/laravel/config/app.php with the following line in the providers array:
Laravel\Spark\Providers\Google2FAServiceProvider::class,
In composer.json we have:
"require": {
...
"doctrine/dbal": "^2.5",
"laravel/framework": "^6.0.0",
"eusebiu/laravel-spark-google2fa": "^2.0.0",
"laravel/cashier": "^10.0.0",
"laravel/spark-aurelius": "^9.0.0",
"laravel/tinker": "^1.0.0",
"laravelcollective/html": "^6.0.0",
"webpatser/laravel-uuid": "2.*"
},
"autoload": {
...
"psr-4": {
"App\\": "app/"
}
},
...
Note: aside from the higher version numbers you see above in the require section, this has been the setup for a long time with the web application running successfully during that time.
Error:
Since we upgraded laravel/spark to laravel/spark-aurelius: ^9.0.0 we've run into one error which prevents the application from running:
In ProviderRepository.php line 208:
Class 'Laravel\Spark\Providers\Google2FAServiceProvider' not found
Failed attempts
We have tried the following to fix this, none of which have worked:
running php artisan config:clear
running php artisan cache:clear
running composer dump-autoload
as per laravel-spark-google2fa docs, running php artisan vendor:publish --provider="Eusebiu\LaravelSparkGoogle2FA\Google2FAServiceProvider" --force
changing how the service provider is specified in app.php
added a new path to autoload in composer.json
downgrading laravel-spark-google2fa to an earlier version
removing and re-installing laravel-spark-google2fa
running spark-installer over the existing application
In all of the above cases the error remains, preventing the application from running.
The laravel-spark-google2fa package may be recently abandoned. I opened an issue there and haven't heard a reply. Laravel/Spark support has not suggested a solution. So I am posting here as a last resort before getting rid of this package and refactoring my code to use a different one.
I was unaware of the bootstrap cache. The bootstrap cache file contained a reference to the Google2FAServiceProvider service provider class which after various package updates and what not was no longer present.
Running commands like php artisan config:clear, php artisan cache:clear, and composer dump-autoload did not clear this cache. In the end, I simply removed the offending file:
filename: services.php
location: /laravel/bootstrap/cache/services.php
config.php, in the same location, can also contain such references.
Note: I used the find feature in VSCode to look for references to this service provider and it did not find this one because the bootstrap cache is gitignored.

Laravel 5.2: While moving to production, class "Collective\Html\HtmlServiceProvider" not found in vendor folder

I have been trying to move my laravel app to production. I following below steps
1. git clone
2. composer install
3. set env variables
4. (artisan key:generate)
5. artisan migrate --seed
But when i ran composer install, am getting the following error
Class 'Collective\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
I know this error means, laravelcollective not added in composer.json and need to following steps as mentioned here
But i already have done the same thing in dev mode and now the composer.json has require "laravelcollective" and aliases in config/app.php.
My question is, do i need to the same thing what i have done in dev (resolving laravelcollective issue) for every new production instance that i am gonna set it up ?
if your project working fine locally, then you have to Run composer update commend under your project repo. did you uploaded vender folder?
Also try to upload(only) vender/composer folder into your vender, and then try to runcomposer installorupdate` command
update it in your composer.json file.
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "5.1.*"
},
then in run command 'composer update' after it add dependancy in you app/config/app.php file..
Try:
composer install --no-scripts
this should install all the dependencies without problem

Adding Guzzle For Mailgun in Laravel 5

I want to use the Mailgun service in Laravel 5. This requires Guzzle 5 to be installed. I've added the following to composer.json, and installed it:
"guzzlehttp/guzzle": "~5.0"
However, my app is giving me this error:
FatalErrorException in MailgunTransport.php line 121:
Class 'GuzzleHttp\Client' not found
I've ran composer dump-autoload. What am I missing? Thanks.
I solve this by using:
"laravel/framework": "5.0.16",
"guzzlehttp/guzzle": "5.2",
composer update
and that is all.
composer install installs the packages (including exact versions) listed in composer.lock. When adding a new package or changing the version requirements, you need composer update (or you can use composer require) as the new package isn't in the lock file yet.
Running composer install when the composer.json has been updated since the last update/require should generate a warning saying Warning: The lock file is not up to date with the latest changes in composer.json, you may be getting outdated dependencies, run update to update them.

Loading a composer package into Laravel 5

Solved: I've added the php and illuminate/support packages into my package composer.json file and it started working. I've got no idea why though so if someone could explain, I would really appreciate it.
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0"
},
I've created a composer package for Laravel 5 which should generate models based on an existing database schema. However i'm unable to load it in.
I add my Command class into the app/Console/Kernel.php
'Iber\Generator\Commands\MakeModelsCommand'
But then I get the following error:
Class Iber\Generator\Commands\MakeModelsCommand does not exist
I'm really new to Laravel and I'm not sure why this is happening since composer generates the autoloader file just fine. I've created and added (into config/app.php) a Service Provider but that doesn't get resolved either. Not sure what I'm doing wrong.
Here's the package:
https://github.com/ignasbernotas/laravel-model-generator
Apparently adding the required attribute with the following packages solved the issue. I'm still not sure why.
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0"
},

Composer update PHP warning -- related to new package? (Laravel4)

I just added a new package to my composer.json in Laravel4 --
"barryvdh/laravel-dompdf": "0.4.*"
and on doing command line "composer update", I got this warning:
PHP Warning: Unexpected character in input: ' in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php on line 118
which I've never seen before on all previous Composer updates, which have all been flawless. In fact, the exact same message appeared 6 times, so I'm assuming that this reflects multiple attempts by Composer.
Here's my "require" array in composer.json:
"require": {
"laravel/framework": "4.2.*",
"barryvdh/laravel-dompdf": "0.4.*"
},
Am I correct in assuming that this relates to bad code in the package I've added, and not something on my end? The only change I made was to add the package to my composer.json file, and that's clearly not what the error message refers to. Thanks.
Take the package out of your composer file, and then do:
composer update
Then, add a different package, if you need an example: use Jefferey Way's laravel generator:
"way/generators": "2.*"
which every laravel install should have. if it runs through correctly, post an issue on the conflicted packages github about the error.
I apologize that i cant give you an exact answer, but unit testing the conflicting package is outside the scope of the question

Categories