Laravel in PHP 8 dev - php

I have a docker container with php 8.0.0-dev and composer. I want to create a Laravel application to test the new PHP but I have some errors.
When I try to create a new laravel project with the command:
composer create-project laravel/laravel test
The error I get is that I don't have the required PHP even though php 8.0.0 is greater than php 7.x.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.6.9 requires php ^7.1.3 -> your PHP version (8.0.0-dev) does not satisfy that requirement.
- laravel/framework v5.6.8 requires php ^7.1.3 -> your PHP version (8.0.0-dev) does not satisfy that requirement.
...
...
Can I skip the php version check somehow?
I have tried with
--prefer-dist
and
--ignore-platform-reqs
but i obtain this error:
Problem 1
- Conclusion: don't install laravel/laravel v7.25.0|remove laravel/laravel v7.25.0
- Installation request for laravel/laravel v7.25.0 -> satisfiable by laravel/laravel[v7.25.0].
Any idea?
Thanks!!!

Laravel supports PHP 8.0 right now, however still some packages are not updated. It affects also some of the PHP extensions:
https://blog.remirepo.net/pages/PECL-extensions-RPM-status
First, make sure you're at the latest version of Laravel 6, 7 or 8 to
get PHP 8 support. Then make sure you're on the very latest version of
any first-party package from Laravel like Passport, Cashier, Dusk,
etc.
There are also a couple of commonly used dependencies you'll need to
update in your composer.json file:
PHP to php:^8.0
Faker to fakerphp/faker:^1.9.1
PHPUnit to phpunit/phpunit:^9.3
Finally, run composer update to update other packages. Make sure to
test your application before updating production. That's it! Enjoy PHP
8!
Source: https://blog.laravel.com/laravel-php-8-support

You are trying to install laravel 5.
For PHP 8 you need at least laravel 6,7 or 8
I prefer laravel 8 (last one)
If you use docker according to laravel 8 documentation you can create project with command:
curl -s https://laravel.build/example-app | bash

Related

Can't install fzaninotto/faker in Codeigniter 4.3.1

I'm trying to install faker in my Codeigniter project , but I got the following error
Problem 1
- fakerphp/faker v1.21.0 conflicts with fzaninotto/faker v1.5.0.
- fzaninotto/faker[v1.6.0, ..., v1.9.2] require php ^5.3.3 || ^7.0 -> your php version (8.0.9) does not satisfy that requirement.
- fakerphp/faker is locked to version v1.21.0 and an update of this package was not requested.
- Root composer.json requires fzaninotto/faker * -> satisfiable by fzaninotto/faker[v1.0.0, ..., v1.9.2].
I've tried running composer update and re-running composer require fzaninotto/faker but I still got the same error.
What can I do to fix this? Thanks
Solution:
Uninstall/remove fzaninotto/faker from your composer.json file since it isn't compatible with your current PHP version (8.0.9) and was abandoned already.
By default, Codeigniter 4 comes with an up-to-date and well-maintained improved alternative (fakerphp/faker) pre-installed/configured.
Reference(s):
fzaninotto/faker
This package is abandoned and no longer maintained. No replacement package was suggested.
Generating Test Data
Often you will need sample data for your application to run its tests.
The Fabricator class uses fzaninotto’s
Faker to turn models into
generators of random data.
FakerPHP
Faker is a PHP library that generates fake data for you. Whether you
need to bootstrap your database, create good-looking XML documents,
fill-in your persistence to stress test it, or anonymize data taken
from a production service, Faker is for you.

unisharp/laravel-ckeditor on Laravel 8+ cannot install package

I'm trying to install ckeditor on my Laravel 8+ project, but can't.
I have the errors:
Problem 1:
Root composer.json requires unisharp/laravel-ckeditor 4.7.2 -> satisfiable by unisharp/laravel-ckeditor[4.7.2].
unisharp/laravel-ckeditor 4.7.2 requires illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but it conflicts with another require.
this is the errors
I've tried install version 4.7.2 and 5.0, but that still not working.
Is someone know how to solve this problem?
I had the same problem. The command composer require ckeditor/ckeditor worked for me.
unisharp/laravel-ckeditor has seen it's latest release in Nov 2017, more than three years ago. As the error message tells you: this package is not compatible with current versions of Laravel. Either downgrade Laravel to v5 (not recommended), search for another package providing such functionality, or fork the package to provide the neccessary updates.
To install ckeditor on Laravel 8+ project.
If you already have npm installed then use this line:
$ npm install ckeditor4
Then execute the following command:
$ npm update
i ran in to the same problem using`
composer require unisharp/laravel-ckeditor
then i used
$ composer require ckeditor/ckeditor
and it solved it

How to downgrade symfony/console, can't install composer package?

i need to use this package mrjgreen/db-sync, i'm using laravel version 5.8.
When i try to install it on my project through composer, it returns the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install mrjgreen/db-sync v3.3.0
- Conclusion: remove symfony/console v4.4.3
- Installation request for mrjgreen/db-sync ^3.3 -> satisfiable by mrjgreen/db-sync[v3.3.0, v3.x-dev].
- Conclusion: don't install symfony/console v4.4.3
I tried to remove symfony/console, but it gives me this message:
"symfony/console is not required in your composer.json and has not been
removed"
and it won't remove it. Any idea of how can i solve this?. Or a similar package that it's compatible with this laravel version. (i need to sync two tables but using a where parameter). Thanks in advance.
The last release of the package you are using was in May 2017 (two and a half years ago at the time of writing). It was built against specific versions of the symfony packages, and since you are now using a younger version of Laravel with different dependencies (which also uses symfony), you are getting a conflict of libraries.
There's no easy solution for you other than find another library to do what you need, fork the library you are trying to use and build your own against the modern dependencies (which should be straight forward if it has a full set of tests), or build your own.
I had this issue as well. I removed laravel/valet and laravel/installer, then installed again and it worked.
composer global remove laravel/valet
Then
composer global remove laravel/installer
Then
composer global require laravel/installer

How to initialise a Symfony Console project using Composer in a way that constrains it to stick to the Long Term Release version?

My goal is to run a Composer's require command to initialise a Symfony Console project.
When running composer's require command, I believe it is possible to restrict the required package to specific a version.
I am considering using this to stick to the Long Term Release version of Symfony which will be supported for longer.
According to the Symfony Release Process the current LTS version is 3.4.
According to Composer's require command documentation and Composer's version constraints documentation, the package and version can be specified as: symfony/console:~3.4.
However, when I run the composer command to install symfony/console 3.4 in an empty directory I get the following errors. (I have PHP and Composer is installed on my MacOS High Sierra):
$ mkdir foo
$ cd foo
$ composer self-update
You are already using composer version 1.6.2 (stable channel).
Johns-MBP:foo jw$ php --version
PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
I have created a new directory, changed into it, ensured composer is updated to the latest version and ensured PHP is 7.*.
$ composer require symfony/console:~3.4
No composer.json in current directory, do you want to use the one at /Users/me/Documents/Projects/FilterProject/filter-environment? [Y,n]? Y
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install symfony/console v3.4.3
- Conclusion: don't install symfony/console v3.4.2
- Conclusion: don't install symfony/console v3.4.1
- symfony/process v2.6.4 conflicts with symfony/console[v3.4.0].
- symfony/console v3.4.0 conflicts with symfony/process[v2.6.4].
- Installation request for symfony/console ~3.4 -> satisfiable by symfony/console[v3.4.0, v3.4.1, v3.4.2, v3.4.3].
- Installation request for symfony/process (locked at v2.6.4, required as ~2.0) -> satisfiable by symfony/process[v2.6.4].
Installation failed, reverting ./composer.json to its original content.
I am quite new to Symfony and so may be misunderstanding the connection between the version number used for Symfony core versus the version number used by Symfony/console.
Which composer command does one run to require the LTS version of Symfony Console in fresh project?
I have managed to get this to work, thanks to #Cerad's comment.
First, I ensured that I have the latest version of composer and PHP 7.
Then I re-ran the command and spotted the problem:
I was installing this application in a sub-folder of a Homestead Improved project and composer was interactively asking me to use its composer.json file!
I was being sloppy and did not read the interactive question fully. I assumed it was asking me to create a new composer.json file. But instead it was asking if I wanted to ammend the composer.json file of the parent project above.
$ composer require symfony/console:~3.4
No composer.json in current directory, do you want to use
the one at /Users/me/Documents/Projects/FilterProject/filter-environment? [Y,n]? Y
If I answered Y then my choice conflicts with some dependencies in the parent project.
By choosing the correct answer of n I did not have a problem and it worked OK.
Installation request for symfony/process (locked at v2.6.4).
This message means that your symfony/process is locked at v2.6.4 (in your composer.lock). Which is confusing, since Composer reported No composer.json in current directory.
Since you've chosen Y to load composer.json from another folder (probably from the different non-related project), so next time try to not select it (by choosing n). So you can install it on the empty folder. If you mean to install it globally, run: composer global require symfony/console.
When you're working with the existing composer.json and composer.lock, try to update your dependencies by:
composer update --with-dependencies
Otherwise, consider removing composer.lock and installing from scratch by composer install.

CakePHP install with Composer version 3.1.*

My problem is that not all server run PHP 5.6 or above.
So I need use a older version of CakePHP 3.1.* that support PHP 5.5.*/5.4.* .
The problem is the Composer install solution:
composer create-project --prefer-dist cakephp/app:3.1.9 demo
Gives me an error:
Could not find package cakephp/app with version 3.1.9
I have tried other version (3.1.11/12/10) without success.
Is there a way or do I need to download the releases manually from GitHub every time?
cakephp/app is a different repository from cakephp/cakephp. So it follows it's own versioning.
cakephp/app is a template/skeleton that you can use to create your app. While cakephp/cakephp is the main core.
Check below for the cakephp/app:
https://github.com/cakephp/app
https://github.com/cakephp/app/releases
I guess you could use the version 3.1.2 of cakephp/app that allows you to have PHP >= 5.4
https://github.com/cakephp/app/blob/3.1.2/composer.json#L8

Categories