Call to undefined method Laravel\Lumen\Routing\Router::middleware() - laravel

After the artisan command composer require dusterio/lumen-passport the error comes Call to undefined method Laravel\Lumen\Routing\Router::middleware()
I dont know why this error occured
I am trying to installing the passport package on laravel lumen framework but because of the error nothing happened

This seems similar to this issue:
https://github.com/dusterio/lumen-passport/issues/175
Try to follow this:
Localized problem, it is some incompatibility with the new version of Passport v11. Adding in composer.json the following line works correctly with Lumen 9:
"laravel/passport": "^10.4"

Related

PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods in laravel

I want to install laravel on my windows but getting below error
Using below command install laravel
composer create-project --prefer-dist laravel/laravel:^7.0 learning-app
But getting below error in command prompt after run the composer command
PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in C:\xampp\htdocs\vendor\kylekatarnls\update-helper\src\UpdateHelper\ComposerPlugin.php on line 11
Trying all the commands like composer update but not getting any success.
My php version PHP 7.3.27
Anyone have idea how to solve then let me know
You're trying to install the laravel framework locked at a version released more than 2 years ago, is there a reason for this?
Also, what is the version of your composer (run composer --version)? If you're at the version 2 try downgrading to v1 and try again with the same command, if you really want the 7.0 version of Laravel (or simply install the newest version of the framework).

Error: In laravel 8 with passport 10 after running composer update command

I have an error while creating passport token in laravel 8 with passport package 10. Everything is working properly before running composer update command. When I run the composer update command I got this error:-
message: "Method Laravel\Passport\Bridge\AccessToken::__toString() must not throw an
exception, caught ErrorException: Using integers for registered date claims is
deprecated, please use DateTimeImmutable objects instead."
exception: "Symfony\Component\ErrorHandler\Error\FatalError"
Please help while resolving this error. Any help would be appreciable.
Current solution is downgrade lcobucci/jwt package.
composer require lcobucci/jwt:3.3.3
Also you can check this https://github.com/laravel/passport/issues/1380

Laravel - compact(): Undefined variable: operator in Builder.php

I have PHP version-7.3 installed in my system and Laravel-5.8. When I tried to rub composer install or composer update on an old Project with Laravel-5.4 and PHP Version-5.6.4, I got this error shown below:
In Builder.php line 1229:
compact(): Undefined variable: operator
Script php artisan optimize handling the post-install-cmd event returned with error code 1
Then, when I tried to run the application, I got this error page as shown on the screen:
I tried to run:
php artisan cache:clear
and
composer update
but the problem is still there.
How do I get it resolved?
Thank you.
It looks like this issue was fixed in Laravel 5.5 according to this post: https://github.com/laravel/framework/issues/26936#issuecomment-449479336
Since Laravel 5.4 is no longer supported, your best option might be to upgrade. You can find a list of the currently supported versions here: https://laravel.com/docs/releases
The minimal upgrade that should still fix the error would be 5.4 to 5.5. The instructions can be found here: https://laravel.com/docs/5.5/upgrade#upgrade-5.5.0 (please note that support for 5.5 has also ended, but it might still fix your bug). This would also require you to switch the project to PHP 7.0.0 or greater.
If:
You can't upgrade for whatever business/team related reason and
Are sure that the Homestead box is running the correct version of PHP (7.2 or lower based on the answer given here) and yet
are still getting this error,
explicitly define the PHP version on the Homestead.yaml file. This should be done on the sites property as such (each is a new line, of course):
map: test.appp
/home/vagrant/code/test/public
php: "7.1"

Laravel BadMethodCallException Call to undefined method [package] when running composer update

I am trying to use this package https://github.com/laracasts/Validation in my Laravel 4.2 project.
This is my composer.json file entry:
"require": {
...
"laracasts/validation": "~1.0"
},
Now when I run the composer update command, I get the following error at the end:
{
"error":{
"type":"BadMethodCallException",
"message":"Call to undefined method [package]",
"file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php",
"line":111
}
}{
"error":{
"type":"BadMethodCallException",
"message":"Call to undefined method [package]",
"file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php",
"line":111
}
}
This is the full output:
C:\wamp\www\project-name>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
{"error":{"type":"BadMethodCallException","message":"Call to undefined method [package]","file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php","line":111}}{"error":{"type":"BadMethodCallException","message":"Call to undefined method [package]","file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php","line":111}}
C:\wamp\www\project-name>
Any idea what this is about and how to fix it?
Make sure you use the latest version of composer. Use the self-update command to update composer itself to its newest version.
composer self-update
Are you sure you're using Laravel 4.2 and not Laravel 5?
Laravel 5 is not even in alpha yet, so things can break at any moment.
Currently, laravel 5 packages are completely broken.

Laravel server hosting error

I had built my website using Laravel 4, and it works fine on localhost but when I host it in my online webserver I've got this error:
Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in /home/.../public_html/bootstrap/compiled.php on line 3242
How can I get rid of this error?
Laravel 4.2 requires PHP 5.4+, make sure you have that.
If you updated from an earlier version of Laravel and on PHP 5.4+, remove public_html/bootstrap/compiled.php and it should work again.
If you can't use 5.4+, use Laravel 4.1 instead of 4.2, so in your composer.json you want "laravel/framework": "4.1.*", instead of what you have now.

Resources