Composer version downgrade issue - composer-php

So I am currently trying to set up an old Laravel project, which requires PHP 7.1. I have successfully downgraded from 8.1 to 7.1, but now the composer issue appears:
I am trying to run composer install on a project, in order to install the dependecies needed, but I am facing the composer version error. After running the suggested command, it basically shows the same error, which does not really make any sense. I have tried other commands but seems like the issue is the same.
I am using MAC.
Any idea?

The message tells you that the current version of Composer installed cannot be run with the current version of PHP installed. Even downgrading is not possible.
To overcome this, you could update PHP again to any supported version (as in: 7.2.5 or later), then downgrade Composer to v2.2, then downgrade PHP again to 7.1.
If you want to ease the switch between PHP versions, you could check for a containerized PHP setup using Docker.

Related

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5"

I'm trying to upload a plain laravel v5.8 project to a server. It gives me this error
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5".
I updated the Laravel version to v6 and it still throws the same thing.
Is there any possible solution I tried many but nothing happens. Thanks in advance.
I faced this problem using the new version of composer, didn't have seen this issue before, although this question is a bit old the solution can help someone else.
I did this working in a development machine, if you really need to change the PHP version running in your server this isn't for you.
This problem is related to a composer configuration when you run the command "composer install" if you need to work with the configuration you already have and don't want to make changes which could lead to other problems you should:
remove the packages you already have installed which includes this configuration from composer
sudo rm -r vendor
run the command again with this flag: --ignore-platform-reqs
composer install --ignore-platform-reqs
Now composer won't perform this check anymore and you are good to go!

How to install mpdf v8 with composer (currently it only installs v6)

I am on ubuntu 12.04 and trying to install the latest release (v8) of mPDF using the following command:
composer require mpdf/mpdf
However, only v6 gets installed.
Is there any easy way to install version 7 or 8 of mPDF - or is it quite a long process?
UPDATE
After running composer require mpdf/mpdf:^8.0
it looks like the PHP version on the server is 5.3.0.
Although none of the domains on the server use this (I use plesk to force all domains to use 7.1).
The PHP version on the server was a lot older than used by plesk.
As composer was looking at the older version, we could download a more recent version of mpdf.

Could not find package codeigniter4/framework with stability stable

I'm doing exactly like what is suggested in the official documentation.
composer create-project codeigniter4/framework
However, I'm getting this error instead:
[InvalidArgumentException]
Could not find package codeigniter4/framework with stability stable.
I fully understand it is not stable yet but I'd like to try and develop a simple app for learning purpose since I've been using CI3 all this while. What should I do? This is the closest possible answer to this question but it was left hanging.
You may install develop branch by:
composer create-project codeigniter4/framework:dev-develop
Codeigniter 4 Moved to Production and also updated documentation in Feb 24,2020 you should try this code in composer
composer create-project codeigniter4/appstarter project-root
Check the latest documentation
Codeigniter4 Documentation
It looks like your PHP version is older than required in codeigniter4. please check whether your PHP version is 7.2(or higher) or not. if you're running below 7.2 version of PHP you'll not be able to use codeigniter4.
Check the php version you have installed globally,
using command php -v in cmd,
if it is below 7.2,
edit the php version in environmental variables.
example: D:\wamp64\bin\php\php7.3.12
this solved the issue I was facing while installing ci4 using composer,
have a good day.

Downgrade from PHP 7.1 to 7.0 for Laravel project

I work with an application in Laravel, facing a problem that cant be solved unless downgrading. So I downgrade my XAMPP form 7.1.14 to 7.0.30
After install it, I open my project and run composer update
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php 7.0.30 but your PHP version (7.1.14) does not satisfy that requirement.
The version doesn't change and the project not working !!!
Uninstall XAMPP and re-install with your suitable version. In past, I have faced same problem. I had problem for upgrade.
Just lower the laravel version in composer.json file, it will automatically use necessary version of PHP

Laravel 5.0 php artisan tinker throwing an error on homestead with php7

I'm using Laravel 5.0 and homestead 0.4.0 wich is shipped with php 7,
so when I use php artisan tinker I get this error:
error
How can I fix this or should I downgrade my php version and if so wouldn't be any conflict with composer or any other tool in my homestead or laravel?
It seems that one of the libraries your application is using - PhpParser - is not compatible with PHP7. It defines a class called String which is a reserved keyword in version 7.
You need to either downgrade to PHP5 or check if it's possible to upgrade your dependencies so that used PhpParser library is compatible with PHP7. Version 2.x of PhpParser should be compatible.
If you're including the package directly in your composer.json try to upgrade version there.
If not, you can see which of your dependencies requires PhpParser by calling
composer depends nikic/php-parser
See if you are able to upgrade versions of packages it lists.
I solved my problem by installing an older version of homestead v0.3.3 wich is shipped with php 5.6 so here is all you need to download it:
$vagrant box add laravel/homestead --box-version 0.3.3
and then download an older version of Homestead installer from git, I'm using v2.1.8 it works fine:

Resources