Unable to update a laravel project from 5.5 to 5.7 - php

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).

Related

Unable to understand why I cannot install laravel-datatables

I'm mantaining an old project, started with laravel 5.4, and now lifted up to laravel 8.
It's all working.
Now I'm in need to install laravel-datatables.
Looking at doc, I discarded v10 because it requires Laravel 9+
For same reason, I discarded also v9
So I'm trying to install laravel-datatables v8
composer require yajra/laravel-datatables-oracle:^8.0
I got this
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires yajra/laravel-datatables-oracle 8.0 -> satisfiable by yajra/laravel-datatables-oracle[v8.0.0].
- yajra/laravel-datatables-oracle v8.0.0 requires illuminate/database 5.4.*|5.5.* -> found illuminate/database[v5.4.0, ..., 5.5.x-dev] but these were not loaded, likely because it conflicts with another require.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
I am not able to understand which package/require is conflicting with this package.
This my package.json
"require": {
"php": "^7.3|^8.0",
"ext-json": "*",
"barryvdh/laravel-dompdf": "^0.8.1",
"buzz/laravel-google-captcha": "^2.1",
"carlos-meneses/laravel-mpdf": "^2.1",
"davidepastore/codice-fiscale": "^0.7.1",
"doctrine/dbal": "^3.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.3",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.2",
"league/flysystem-sftp": "~1.0",
"maatwebsite/excel": "^3.1",
"nowakowskir/php-jwt": "^2.0",
"oriceon/toastr-5-laravel": "^1.0.0",
"pragmarx/google2fa-laravel": "^1.4",
"pragmarx/recovery": "^0.2.0",
"ramsey/uuid": "^4.1",
"sentry/sdk": "^3.1",
"sentry/sentry-laravel": "^2.4",
"shalvah/laravel-jsend": "^2.3",
"snowfire/beautymail": "^1.1"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
Same problem with v7
Please note: we cannot, for internal policy, use -dev branches
Trying to install v9 ...
Problem 1
- Root composer.json requires yajra/laravel-datatables-oracle 9 -> satisfiable by yajra/laravel-datatables-oracle[v9.0.0].
- yajra/laravel-datatables-oracle v9.0.0 requires illuminate/database 5.8.* -> found illuminate/database[v5.8.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
As written in the error message: yajra/laravel-datatables-oracle in v8 is only compatible with Laravel v5, and you are using Laravel v8.
Try to use composer require yajra/laravel-datatables-oracle:^9.0 - this version is compatible with Laravel v5 to v8. Next time you are facing such a problem, have a look at the constraints of different versions of the package. Packagist has a pretty nice overview of the compatible versions, for example at https://packagist.org/packages/yajra/laravel-datatables-oracle#v9.21.2 where you can see the dependencies for the latest v9 version of that datatables package
I accepted answer from Nico Haase because it helped me found the solution, but this is the exact solution for my exact case
composer require yajra/laravel-datatables-oracle:^9.*
It installed the 9.21.x version and it's compatibile with my actual set of package

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

Cannot add new package to laravel project

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.

Composer package dependencies are not loading with main package

I have a composer package that in turn should load a couple of dependencies, but is not.
My top level (testing project) composer,json:
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"jrmadsen67/mahana-generator-scaffolding": "dev-master#dev"
},
From jrmadsen67/mahana-generator-scaffolding (full file here: https://github.com/jrmadsen67/MahanaGeneratorScaffolding/blob/master/composer.json) - (I've tried with "minimum-stability": "dev" but that did not make any difference)
"require": {
"php": ">=5.4",
"illuminate/support": "~5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"jrmadsen67/mahana-laravel5-generators": "dev-master",
"laracasts/generators": "dev"
},
jrmadsen67/mahana-laravel5-generators can be found here: https://github.com/jrmadsen67/mahana-laravel5-generators
laracasts/generators is a several years old project. Both the Generators dependent packages load fine individually; the issue is something in how I am trying to call them from the parent composer.json, I'm sure.
TIA!
I cloned your jrmadsen67/mahana-generator-scaffolding repo, did composer installand got the following error:
The requested package laracasts/generators dev exists as laracasts/generators[1.0, 1.0.1, 1.0.2, 1.0.3, 1.1, 1.1.1, 1.1.2, 1.1.3, dev-master] but these are rejected by your constraint.
So, I forked your repo, changed the laracasts/generators constraint to "dev-master" instead. Then, I tested my fork and it seemed to install fine.
I made PR, but it's a simple fix you can make in about 2 seconds if this helps out your issue.

Categories