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/
Related
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
I am using Laravel version 5.2 and Jenssegers MongoDB. I installed both and working fine but I have to use any other library and made changes in composer.json after that use command composer update. After using this command automatically Jenssegers MongoDB file removed. I don't know why this happen. After composer update why Jenssegers MongoDB file removed automatically? Please suggest me how to handel this?
My composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"acacha/admin-lte-template-laravel": "2.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/common_helper.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
Write this "jenssegers/mongodb": "*", line in your composer.json file:-
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"acacha/admin-lte-template-laravel": "2.*",
"jenssegers/mongodb": "*",
},
And add the service provider in config/app.php
Jenssegers\Mongodb\MongodbServiceProvider::class,
Jenssegers\Mongodb\Auth\PasswordResetServiceProvider,
then go to project root directory in terminal and run command composer update .
In model file, you need to add below line at the top,
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
Reference :- documentation
composer update --no-scripts
you can stop scripts run
Getting the error on composer update command.
My composer.json file is:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"illuminate/html": "^5.0",
"barryvdh/laravel-debugbar": "~2.0",
"spatie/laravel-paginateroute": "^2.0",
"darkaonline/l5-swagger": "~2.0",
"yajra/laravel-datatables-oracle": "~5.0",
"phpoffice/phpexcel": "^1.8"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0"
},
"autoload": {
"classmap": [
"database"
],
"files": ["app/Helpers/helpers.php"],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
You need to remove this outdated package (taken out of the core and no longer supported):
"illuminate/html": "^5.0",
When you remove it, you need to also remove its service providers / aliases. So, if you open up config/app.php, you will see a providers and aliases section. Remove these lines of code if you haven't done so already.
'Illuminate\Html\HtmlServiceProvider'
'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade',
In place of it, you should install the Laravel collective package. To install that, replace the illuminate/html package with this:
"laravelcollective/html": "5.2.*"
Then in your config/app.php file, add this to your providers array:
Collective\Html\HtmlServiceProvider::class
and this to your aliases array:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
The docs can be found here: https://laravelcollective.com/docs/5.2/html
Look at this
https://laracasts.com/discuss/channels/laravel/call-to-undefined-method-illuminatefoundationapplicationbindshared
Quote "bindShared has been renamed to $app->singleton()"
[Edit]
I think you have something is your own custom code what need to be changed from : $this->app->bindShared() to: $this->app->singleton().
I solved it by the steps mentioned in Link1 Link2
After the upgrade please make sure all the Deprecations mentioned in Link2 are corrected in your current app. For me Illuminate\Contracts\Routing\Middleware had to be removed from all the Middlewares.
Also I had to install latest version of certain packages like "yajra/laravel-datatables-oracle": "~6.1.1",
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
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.*"
},