3

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!!!

IMSoP
  • 89,526
  • 13
  • 117
  • 169
hazardco
  • 387
  • 1
  • 4
  • 13
  • 1
    Have you already seen the [answer](https://stackoverflow.com/a/26547261) to "Skip composer PHP requirement" (see also the [composer doc](https://getcomposer.org/doc/03-cli.md) about `--ignore-platform-reqs` and `--ignore-platform-req`)? – Jeanne Dark Aug 16 '20 at 09:20

2 Answers2

1

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

Jsowa
  • 9,104
  • 5
  • 56
  • 60
0

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