Laravel 在 PHP 8 位开发者中

Laravel in PHP 8 dev

我有一个带有 php 8.0.0-dev 和作曲家的 docker 容器。我想创建一个 Laravel 应用程序来测试新的 PHP 但我有一些错误。

当我尝试使用以下命令创建新的 laravel 项目时:

composer create-project laravel/laravel test

我得到的错误是我没有所需的 PHP 即使 php 8.0.0 大于 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.
    ...
    ...

我可以跳过 php 版本检查吗?

我试过

--prefer-dist

--ignore-platform-reqs

但我得到这个错误:

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

有什么想法吗?

谢谢!!!

Laravel 目前支持 PHP 8.0,但仍有一些软件包未更新。它也影响一些 PHP 扩展: 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!

来源:https://blog.laravel.com/laravel-php-8-support

您正在尝试安装 laravel 5。 对于 PHP 8 你至少需要 laravel 6,7 或 8 我更喜欢laravel 8(最后一个)

如果您根据 laravel 8 文档使用 docker,您可以使用以下命令创建项目:

卷曲-s https://laravel.build/example-app | bash