我已经在使用symfony 3了,我已经用它创建了很多项目,所以现在我正试图用symfony 4创建一个项目,但当我键入以下命令时我做不到:
composer create-project symfony/skeleton my-project-symf-4
该项目创建成功,但这个版本3.4而不是4.2产生的问题,
Installing symfony/skeleton (v3.4.22.1)
- Installing symfony/skeleton (v3.4.22.1): Downloading (100%)
Created project in my-project-symf-4
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 22 installs, 0 updates, 0 removals
- Installing symfony/flex (v1.1.8): Downloading (100%)
Prefetching 21 packages
- Downloading (100%)
- Installing psr/cache (1.0.1): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v3.4.22): Loading from cache
- Installing symfony/console (v3.4.22): Loading from cache
- Installing symfony/dotenv (v3.4.22): Loading from cache
- Installing symfony/routing (v3.4.22): Loading from cache
- Installing symfony/http-foundation (v3.4.22): Loading from cache
- Installing symfony/event-dispatcher (v3.4.22): Loading from cache
- Installing symfony/http-kernel (v3.4.22): Loading from cache
- Installing symfony/finder (v3.4.22): Loading from cache
- Installing symfony/filesystem (v3.4.22): Loading from cache
- Installing symfony/dependency-injection (v3.4.22): Loading from cache
- Installing symfony/config (v3.4.22): Loading from cache
- Installing symfony/class-loader (v3.4.22): Loading from cache
- Installing symfony/polyfill-apcu (v1.10.0): Loading from cache
- Installing symfony/cache (v3.4.22): Loading from cache
- Installing symfony/framework-bundle (v3.4.22): Loading from cache
- Installing symfony/yaml (v3.4.22): Loading from cache
Generating autoload files
正如您所看到的,composer从缓存加载所有包。我试着像这样清除composer缓存:
$ composer clearcache
但没有结果,问题仍然存在。
我的PHP版本是7.3.1
有人能帮我解决那个问题吗?
尝试像这样传递symfony版本(例如4.2):
composer create-project symfony/skeleton:4.2 my-project-symf-4
希望这能有所帮助!
如果您在系统中安装了symfony CLI,则只需运行以下命令并指定版本号
例如,使用4.4版本创建Symfony项目,请运行以下命令
symfony new my_project_name--版本=4.4