laravel installing older package version - laravel

I'm trying to install this package https://packagist.org/packages/ultraware/roles for laravel 5.3.
simply applying composer require ultraware/roles doesn't work as it is not compatible with laravel 5.3 and i guess I should install an older version of the package. How can i do it. When i try to run
composer require ultraware/roles^1.7.* I get:
Could not find a matching version of package
How can i install version 1.7 of this package?

Not sure why you'd want version 1.7 of this package to be installed, looks like 5.3.1 is a version compatible with Laravel 5.3.
Note:
This package is abandoned and no longer maintained.
If you still want to install a specific version of this package use the following:
composer require ultraware/roles "5.3.1"

Related

league/flysystem-aws-s3-v3 on Laravel 8 other packages require lower version

When running composer require league/flysystem-aws-s3-v3 I get:
league/flysystem-aws-s3-v3[2.0.0, ..., 2.x-dev] require league/flysystem ^2.0.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
In my composer.json there is no mention of league/flysystem, but it does appear in my composer.lock as "league/flysystem": "^1.1",. It looks like I have a few packages (like spatie/laravel-backup) that have this as an dependancy.
How do I proceed? I'm not sure how to update a package that other packages have as an dependancy, and that these other packages have also fixed to a specific version.
As you've found already: spatie/laravel-backup is not yet compatible with league/flysystem v2 (which is pretty new, it got released... yesterday!).
Simply require the "old" version of that AWS package through composer require league/flysystem-aws-s3-v3:"^1.0".
After all, this is not a problem of Laravel itself.
I am using the latest version of laravel V8.4.0 (JULY 2021)
I solve this by:
Deleting composer.lock in the root folder of the project
running composer require league/flysystem-aws-s3-v3:"~1.0"
For Laravel 8 use
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"
It is a problem with Laravel. Laravel v8 does not support league/flysystem v2 yet. v9 will be shipped with a support for it: https://github.com/laravel/framework/pull/33612
For those on Laravel 9, you'll need to upgrade to v3.0 instead.
composer require -W league/flysystem-aws-s3-v3 "^3.0"
After deleting compose.lock

How to find and treat the cause of an outdated composer package that is not in my composer.json?

I ran composer outdated command:
$ composer outdated
phpdocumentor/type-resolver 0.4.0 0.7.1
but looking inside composer.json, I see no such package. In my case there is no type-resolver.
How do I find an outdated package that is missing in composer.json belongs to and how do I update it?
Composer install not only packages that are listed directly in composer.json but also packages that are dependencies of packages that are listed in composer.json. Assuming you have in composer package vendor/A and this package requires vendor/B you will have installed both A and B packages.
So in your case you can run:
composer update phpdocumentor/type-resolver
to try to update this package.
Of course it does not mean it will be possible to update this way. It's possible that you might need to run:
composer update
but this will update all packages (and depends on scenario this is what you can accept or maybe you don't want to update all packages).
It's also possible that it won't be possible to update this package because other package that is used has phpdocumentor/type-resolver dependency set to for example 0.4.* so 0.7 version is not compatible with this package and version 0.7 won't be installed

How to configure the Composer to always download the latest version?

My composer is downloading version 5.4.36. How to configure the Composer to always download the latest version.
Laravel 5.4 is the latest version with PHP 5.6 support.
Laravel 5.5 requires PHP 7.0, Laravel 5.6 requires PHP 7.1.

spatie/laravel-newsletter doesn't work on laravel 5.4

Here is the image below
See the image of composer command
Because the latest version is to be used on 5.5.
You can pull an older version if you want:
composer require spatie/laravel-newsletter 3.7.0

Laravel - Installing packages for older version

I am trying to install a package (https://github.com/ollieread/multiauth), and the site says that i requires Laravel 4.1. I am running Laravel 4.2, and so when I run composer update I get
Your requirements could not be resolved to an installable set of packages.
Why can't I install this on a higher version of Laravel?
You can't install it on higher version of Laravel is because it's been just only support for 4. 1. * of Laravel Version according to their composer.json

Resources