Laravel Weblee\Mandrill\MandrillServiceProvider' class not found - laravel

I am trying to "merge" Mandrill in Laravel. I always get the same error on my page. Class 'Weblee\Mandrill\MandrillServiceProvider' not found. The weird thing is that I did name the class in my config.app.
Steps that I did.
Mandrill template and stuff around
Complete .env file with the data it needs.
Included "weblee/mandrill": "dev-master" en my composer.json after laravel/framework
2 folders in vendor, weblee and Mandrill.
added provider and alias
composer update composer dump-autoload/ composer install ==> returning error Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException] Error Output: PHP Fatal error: Class Weblee\Mandrill\MandrillServiceProvider' not found in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
This is my config/app.php
'providers' => [
Weblee\Mandrill\MandrillServiceProvider::class,
],
'aliases' => [
*Other aliases*
'MandrillMail' => 'Weblee\Mandrill\MandrillFacade',
],
cmposer.json
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"weblee/mandrill": "dev-master"
},
rest of code

Here is the way to do this
First, install weblee package using composer.json file.
Add this in your composer.json file
"require": {
"php": "^7.1.3",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"weblee/mandrill": "dev-master"
},
And after that run composer update
then add your Weblee\Mandrill\MandrillServiceProvider::class, in config\app.php
One more thing
'aliases' => [
*Other aliases*
'MandrillMail' => Weblee\Mandrill\MandrillFacade::class,
],
Don't use single quotes

Related

php/laravel -- php artisan serve -- opensuse 15.0 error

So I am new to php/laravel and am trying to set up my environment here with composer on opensuse 15.0.
When I try to run php artisan migrate
I get this error:
PHP Warning: require(/home/mattyo/FirstLaravelProject/matt-project-laravel/vendor/autoload.php): failed to open stream: No such file or directory in /home/mattyo/FirstLaravelProject/matt-project-laravel/artisan on line 18
PHP Fatal error: require(): Failed opening required '/home/mattyo/FirstLaravelProject/matt-project-laravel/vendor/autoload.php' (include_path='.:/usr/share/php7:/usr/share/php7/PEAR') in /home/mattyo/FirstLaravelProject/matt-project-laravel/artisan on line 18
I get the same error when trying to run php artisan serve.
I have tried to run composer update along with composer install composer update --no-scripts and had no luck.
Any help would be greatly appreciated.
here's my composer.json
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"laravel/framework": "^7.29",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.0",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.3",
"phpunit/phpunit": "^8.5.8|^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
After running composer global require laravel/installer I received the following error message:
Changed current directory to /home/mattyo/.config/composer
Using version ^3.0 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/installer[v3.0.0, ..., v3.0.1] require ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
- laravel/installer[v3.1.0, ..., v3.2.0] require php ^7.2.9 -> your php version (7.2.5) does not satisfy that requirement.
- Root composer.json requires laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1, v3.1.0, v3.2.0].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php7/cli/php.ini
- /etc/php7/conf.d/ctype.ini
- /etc/php7/conf.d/dom.ini
- /etc/php7/conf.d/iconv.ini
- /etc/php7/conf.d/json.ini
- /etc/php7/conf.d/mbstring.ini
- /etc/php7/conf.d/openssl.ini
- /etc/php7/conf.d/pdo.ini
- /etc/php7/conf.d/pdo_sqlite.ini
- /etc/php7/conf.d/phar.ini
- /etc/php7/conf.d/sqlite3.ini
- /etc/php7/conf.d/tokenizer.ini
- /etc/php7/conf.d/xmlreader.ini
- /etc/php7/conf.d/xmlwriter.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
It seems the autoload.php file wasn't created by Composer for some reason. try composer dump-autoload and see if it works by running php artisan in the terminal.
If this issue still exists, remove the ./vendor directory with rm -rf vendor/* and remove composer cache composer clearcache. Then run composer install again
If none of the above solved the problem, Check if the composer.json file contains wrong or missing dependencies.

I'm getting error Class 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider' not found

I'm installing jwt-auth package.I run this command
composer require tymon/jwt-auth
There is composer.json file
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^2.0",
"tymon/jwt-auth": "^1.0"
},
And there is app.php file
'providers' => [
........
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
],
'aliases' => [
........
'JWTAuth' =>Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
],
When is I run this command.
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
getting error.
In ProviderRepository.php line 208:
Class 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider' not found
You are probably reading old docs or watching some tutorial video for old version.
It should be:
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
Docs: https://jwt-auth.readthedocs.io/en/develop/laravel-installation/

Class 'Laravel\Passport\Passport' not found on Laravel 5.7

I just cloned a repo with a Laravel 5.7 project, and I am having some troubles to run it on my machine.
When I make a composer install, I get this error:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
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.
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover
In AuthServiceProvider.php line 35:
Class 'Laravel\Passport\Passport' not found
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
What can I do to solve this error? I dont know where to start.
This is the project's composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"designmynight/laravel-mongodb-passport": "^1.1",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"jenssegers/mongodb": "^3.4",
"laravel/framework": "5.7.*",
"laravel/passport": "^7.0",
"laravel/tinker": "^1.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Although composer update did the trick depending on situation it might not be the best solution.
First of all - when running composer install packages are installed based on versions that are in composer.lock if it's included in repository (it should be).
And in your case when you look carefully at console output you had:
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.
So it's quite possible that someone added Laravel Passport package to composer.json but haven't run composer install or forgot to commit updated composer.lock file.
Now remember when running composer update you update all the packages. Sometimes it's fine (only on localhost) but sometimes it's not because not always you want to update all packages. So when you need to update single package you could try in this case also composer update laravel/passport just to force updating/installing just Laravel Passport without touching other packages.
It looks like you need to do
composer update
instead of install?

Why running composer install --no-dev I got error with Barryvdh\Debugbar\ServiceProvider?

I install my laravel 5.7 app (production) at live server and with no dev tools command command I got error:
composer install --no-dev
...
- Removing barryvdh/laravel-debugbar (v3.2.1)
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover
In ProviderRepository.php line 208:
Class 'Barryvdh\Debugbar\ServiceProvider' not found
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
In my composer.json I have barryvdh/laravel-debugbar under dev block:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
...
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"orangehill/iseed": "^2.6",
"phpunit/phpunit": "^7.0",
"xethron/migrations-generator": "^2.0"
},
In my config/app.php I have :
'providers' => [
...
Barryvdh\Debugbar\ServiceProvider::class,
'aliases' => [
...
'Debugbar' => Barryvdh\Debugbar\Facade::class,
Why this error and how to fix it?
Thanks!
Before running
composer install --no-dev
1) Clear bootstrap/cache subdirectory as mentioned above
2) remove /vendor/ directory if you have it
3) Remove from config/app.php  ll lines with :
Barryvdh\Debugbar

Trouble upgrading to Laravel 4.1

I'm having trouble upgrading to 4.1.
I've followed the upgrade guide in the docs but when I run composer update, I get the following error:
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
PHP Fatal error: Call to undefined method
Illuminate\Foundation\Application::bindShared() in
/site/vendor/laravel/framework/src/Illuminate/Queue/FailConsoleServiceProvider.php
on line 26
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call
to undefined method
Illuminate\Foundation\Application::bindShared()","file":"/site/vendor/laravel/framework/src/Illuminate/Queue/FailConsoleServiceProvider.php","line":26}}Script
php artisan clear-compiled handling the post-update-cmd event returned
with an error
[RuntimeException]
Error Output: PHP Fatal error: Call to undefined method
Illuminate\Foundat ion\Application::bindShared() in /site/vendor
/laravel/framework/src/Illuminate/Queue/FailConsoleServiceProvider.php
on l ine 26
However, if I create a new project and use the same composer.json file, it runs successfully.
Can anyone point me in the right direction?
Here is the contents of my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*",
"anahkiasen/html-object": "dev-master",
"anahkiasen/former": "dev-master",
"laravelbook/ardent": "dev-master",
"nesbot/Carbon": "*",
"jasonlewis/basset": "dev-master",
"robclancy/presenter": "1.1.*",
"way/generators": "dev-master",
"baum/baum": "dev-develop",
"loic-sharma/profiler": "1.1.*",
"thapp/jitimage": "dev-master",
"way/generators": "dev-master",
"jasonlewis/basset": "dev-master",
"cartalyst/sentry": "2.0.*",
"edvinaskrucas/notification": "1.*",
"laravelbook/ardent": "dev-master",
"orangehill/iseed": "dev-master",
"greggilbert/recaptcha": "dev-master",
"zizaco/factory-muff": "dev-master",
"mockery/mockery": "dev-master",
"way/phpunit-wrappers": "dev-master"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
Quick update. I've got it to work now. I had a few packages in my workbench directory which each had their own composer.json file. I had to update the require section to read:
"require": {
"php": ">=5.3.0",
"illuminate/support": "4.*"
},

Resources