Cannot add new package to laravel project - php

I'm currently working on an old project created by different developers. But when I'm adding a new package to composer.json file, it returns a lot of errors. Please see my code and screenshot below.
Package I'm trying to add
"aws/aws-sdk-php-laravel": "~3.0"
composer.json
"require": {
"php": ">=7.0.0",
"aceraven777/laravel-paymaya": "^1.0",
"aloha/twilio": "^4.0",
"fideloper/proxy": "~3.3",
"florianv/laravel-swap": "^1.3",
"freshbitsweb/laratables": "^1.1",
"intervention/image": "^2.4",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4.0",
"maatwebsite/excel": "~2.1.0",
"mews/captcha": "^2.2",
"paypal/rest-api-sdk-php": "^1.13",
"php-http/guzzle6-adapter": "^1.1",
"php-http/message": "^1.7",
"stevebauman/location": "^3.0",
"tymon/jwt-auth": "dev-develop",
"cartalyst/stripe-laravel": "2.0.*",
"aws/aws-sdk-php-laravel": "~3.0"
}
Errors in command prompt

Remove the package from composer.json and use composer require aws/aws-sdk-php-laravel.
The thing is that when you run composer install it uses composer.lock, but it isn't synced with composer.json. composer update probably will work, but isn't good approach.

First of all, it's no error. These are some warnings and somehow when you want to install your package, package name was added to your composer.json but not download. You can remove that package manually or by composer remove YOUR_PACAKGE.
Then again install that package.

Related

Laravel SocialiteProviders\Twitter\Server::getAuthorizationUrl () compatible Issue

I have cloned laravel 6.2 projects from the git repository into my local system. that project has worked with the laravel socialite package. after cloned I tried with composer install. when the "Generating optimized autoload files" step the following error was thrown.
ErrorException : Declaration of SocialiteProviders\Twitter\Server::getAuthorizationUrl($temporaryIdentifier) should be compatible with League\OAuth1\Client\Server\Server::getAuthorizationUrl($temporaryIdentifier, array $options = Array)
refer screenshot also
Composer.json file having
"require": {
"php": "^7.2",
"camroncade/timezone": "0.1",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.0",
"jenssegers/agent": "^2.6",
"laravel/framework": "^6.2",
"laravel/socialite": "^4.3",
"laravel/tinker": "^2.0",
"maatwebsite/excel": "^3.1",
"scottybo/laravel-facebook-sdk": "^4.0",
"socialiteproviders/facebook": "^1.0",
"socialiteproviders/pinterest": "^3.0",
"socialiteproviders/twitter": "^3.0",
"thujohn/twitter": "^2.2"
},
How to Fix this issue?

How can we downgrade Laravel dependencies from php 8 to php 7.4

I have this laravel project, but due the specific version of it's dependencies it need php 8 to run, but I need it to run with php 7.4, is there a way so that we can downgrade the dependencies?
....
"require": {
"php": "^8.0.2",
"barryvdh/laravel-debugbar": "^3.6",
"fruitcake/laravel-cors": "^2.0.5",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^9.0",
"laravel/sanctum": "^2.14",
"laravel/tinker": "^2.7",
"laravel/ui": "^3.4",
"laravelcollective/html": "^6.3"
},
"require-dev": {
"brianium/paratest": "^6.4",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"pestphp/pest-plugin-laravel": "^1.2",
"pestphp/pest-plugin-parallel": "^1.0",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
...
Note: So far I could only found that manually searching for proper version compatible to php 7.4 and adjust it inside composer.json manually is an option.
Laravel 9 works only on PHP 8, so you can't, unless you are up to downgrading Laravel version too. But installing newer PHP will be faster.
Laravel 9 works on > php8 so you can't downgrade php version to 7.4
laravel support policy
I recently did the same to one of my projects, so I did it like so
Backup your project (just C/P it so you have a reserve if something goes wrong);
Change the dependencies you need;
Delete the vendor folder;
I also deleted the composer.lock but I think you can actually skip this step;
Run composer install;

Facing issues while installing mews/captcha in Laravel

I have installed the latest PHP version on my device. I am trying to install mews/captcha library in my project but due to some version conflicts, I am failing to do so.
composer.json :
"require": {
"php": "^7.3|^8.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"mews/captcha": "~2.0"
},
"minimum-stability": "dev",
This is the output in terminal:
I have tried commands -
composer update
composer install --ignore-platform-reqs
composer require mews/captcha:*
All are not working

Composer returns nothing to update while trying to update sentry-laravel package

I'm trying to update the sentry-laravel package because we are using version 0.10.0 while the version 1.4.1 it is available.
I've searched about the composer update command and found that you should only use composer update vendor/package or composer update vendor/package --with-dependencies so I did it and in the end I received the message: Nothing to update.
I don't know if I am doing something wrong but I don't think so...
We're using Laravel 5.6 and I am using Composer 1.9.0
The composer.json file:
"require": {
"php": "^7.1.3",
"ext-gd": "*",
"aws/aws-sdk-php": "^3.55",
"bacon/bacon-qr-code": "1.0.3",
"barryvdh/laravel-dompdf": "^0.8.3",
"doctrine/dbal": "^2.8",
"fideloper/proxy": "~4.0",
"fzaninotto/faker": "^1.4",
"guzzlehttp/guzzle": "^6.3",
"jenssegers/agent": "^2.6",
"laravel/framework": "5.6.*",
"laravel/homestead": "^7.3",
"laravel/tinker": "^1.0",
"league/csv": "^9.0",
"league/flysystem-aws-s3-v3": "^1.0",
"maatwebsite/excel": "^3.1",
"plivo/php-sdk": "^4.0",
"pragmarx/google2fa-laravel": "^0.2.0",
"sentry/sentry-laravel": "^0.10.0",
"simplesoftwareio/simple-qrcode": "~2",
"spatie/laravel-permission": "^2.12"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"beyondcode/laravel-dump-server": "^1.2",
"beyondcode/laravel-query-detector": "^1.0",
"filp/whoops": "^2.0",
"imanghafoori/laravel-anypass": "^1.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
Anyone have been through this sometime?
You can't update to the latest version because it's incompatible with Laravel 5.6
From the package's readme
Laravel Version Compatibility
Laravel 4.2.x is supported until version 0.8.x
Laravel <= 5.7.x on PHP <= 7.0 is supported until version 0.11.x
Laravel >= 5.x.x on PHP >= 7.1 is supported in the most recent version
Laravel >= 6.x.x on PHP >= 7.2 is supported in the most recent version
So you have to update Laravel as well if you want to update the package
Hope this helps
Looks like you can't update to the latest version, but you can update to 0.11.x if you change your composer.json entry to
"sentry/sentry-laravel": "^0.11.*"

Unable to update a laravel project from 5.5 to 5.7

I recently started working on a project that was originally in Laravel 5.2 which I successfully upgraded to Laravel 5.5 however now I'm trying to upgrade once again to Laravel 5.7 but when I do a composer update it gets stuck at Resolving dependencies through SAT. Here is the required and required-dev section of composer.json file:
"require": {
"php": "^7.2.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.5.0",
"unisharp/laravel-ckeditor": "^4.5",
"barryvdh/laravel-debugbar": "^3.1",
"milon/barcode": "^5.2",
"barryvdh/laravel-dompdf": "^0.8.0",
"hisorange/browser-detect": "2.*",
"sentry/sentry-laravel": "^0.7.0",
"laravel/cashier": "~6.0",
"dingo/api": "1.0.*#dev"
},
"require-dev": {
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
"xethron/migrations-generator": "dev-l5",
"way/generators": "dev-feature/laravel-five-stable"
},
Not sure what could be the problem.... Is there something missing?
The issue is likely to do with one of the pages you're trying to install / update. If composer install -vvv doesn't give you any information on what package might be causing the error, you'll need to troubleshoot by trying to install each package individually using:
composer require unisharp/laravel-ckeditor:4.5
composer require barryvdh/laravel-debugbar:3.1
...
Eventually, composer will tell you which package is causing the issue. Once you identify the packages, you'll need to check that the version you're trying to install is compatible with Laravel 5.7. Tweak the version number in the composer require ... command line until you find one that works (could be higher or lower).

Categories