Symfony框架

Posted wgchen~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Symfony框架相关的知识,希望对你有一定的参考价值。

安装Symfony框架

composer create-project symfony/framework-standard-edition symfony

Creating a "symfony/framework-standard-edition" project at "./symfony"
Composer 2 repository support for https://mirrors.cloud.tencent.com/composer has been disabled due to what seems like a misconfiguration. If this is a packagist.org mirror we recommend removing it as Composer 2 handles network operations much faster and should work fine without.
Installing symfony/framework-standard-edition (v3.4.47)
  - Installing symfony/framework-standard-edition (v3.4.47): Extracting archive
Created project in D:\\Centos\\phpstudyWWW\\symfony
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 39 installs, 0 updates, 0 removals
    0 [>---------------------------]    0 [>---------------------------]
  - Installing doctrine/lexer (1.0.2): Extracting archive
  - Installing doctrine/annotations (v1.4.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.19.0): Extracting archive
  - Installing twig/twig (v1.42.5): Extracting archive
  - Installing paragonie/random_compat (v2.0.19): Extracting archive
  - Installing symfony/polyfill-php70 (v1.19.0): Extracting archive
  - Installing symfony/polyfill-util (v1.19.0): Extracting archive
  - Installing symfony/polyfill-php56 (v1.19.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.19.0): Extracting archive
  - Installing symfony/symfony (v3.4.47): Extracting archive
  - Installing symfony/polyfill-intl-icu (v1.19.0): Extracting archive
  - Installing symfony/polyfill-apcu (v1.19.0): Extracting archive
  - Installing psr/simple-cache (1.0.1): Extracting archive
  - Installing psr/log (1.1.3): Extracting archive
  - Installing psr/link (1.0.0): Extracting archive
  - Installing psr/container (1.0.0): Extracting archive
  - Installing psr/cache (1.0.1): Extracting archive
  - Installing fig/link-util (1.1.1): Extracting archive
  - Installing doctrine/inflector (v1.1.0): Extracting archive
  - Installing doctrine/collections (v1.4.0): Extracting archive
  - Installing doctrine/cache (v1.6.2): Extracting archive
  - Installing doctrine/common (v2.7.3): Extracting archive
  - Installing jdorn/sql-formatter (v1.2.17): Extracting archive
  - Installing doctrine/doctrine-cache-bundle (1.3.5): Extracting archive
  - Installing doctrine/dbal (v2.5.13): Extracting archive
  - Installing doctrine/doctrine-bundle (1.10.3): Extracting archive
  - Installing doctrine/instantiator (1.0.5): Extracting archive
  - Installing doctrine/orm (v2.5.14): Extracting archive
  - Installing incenteev/composer-parameter-handler (v2.1.4): Extracting archive
  - Installing composer/ca-bundle (1.2.8): Extracting archive
  - Installing sensiolabs/security-checker (v5.0.3): Extracting archive
  - Installing sensio/distribution-bundle (v5.0.25): Extracting archive
  - Installing sensio/framework-extra-bundle (v5.2.4): Extracting archive
  - Installing sensio/generator-bundle (v3.1.7): Extracting archive
  - Installing monolog/monolog (1.25.5): Extracting archive
  - Installing symfony/monolog-bundle (v3.6.0): Extracting archive
  - Installing symfony/phpunit-bridge (v3.4.46): Extracting archive
  - Installing swiftmailer/swiftmailer (v5.4.12): Extracting archive
  - Installing symfony/swiftmailer-bundle (v2.6.7): Extracting archive
  0/29 [>---------------------------]   0%
 10/29 [=========>------------------]  34%
 20/29 [===================>--------]  68%
 29/29 [============================] 100%
Package sensio/distribution-bundle is abandoned, you should avoid using it. No replacement was suggested.
Package sensio/generator-bundle is abandoned, you should avoid using it. Use symfony/maker-bundle instead.
Generating autoload files
12 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> Incenteev\\ParameterHandler\\ScriptHandler::buildParameters
Creating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_host (127.0.0.1):
database_port (null):
database_name (symfony):
database_user (root):
database_password (null):
mailer_transport (smtp):
mailer_host (127.0.0.1):
mailer_user (null):
mailer_password (null):
secret (ThisTokenIsNotSoSecretChangeIt):
> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap
> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache

 // Clearing the cache for the dev environment with debug true

 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.

> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets

 Trying to install assets as relative symbolic links.

 [OK] No assets were provided by any bundle.

> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile
> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget
PS D:\\Centos\\PHPstudyWWW>

上面这些代码不用管,一路回车就好;

运行Symfony

symfony\\bin> php .\\console server:run

 [OK] Server listening on http://127.0.0.1:8000

 // Quit the server with CONTROL-C.

[Thu Sep 30 17:40:00 2021] 127.0.0.1:54437 [200]: /
[Thu Sep 30 17:40:01 2021] 127.0.0.1:62845 [200]: /_wdt/910535
[Thu Sep 30 17:40:01 2021] 127.0.0.1:58137 [200]: /favicon.ico

以上是关于Symfony框架的主要内容,如果未能解决你的问题,请参考以下文章

推进学说代码片段

php symfony框架配置

行业资讯Symfony 5.1.1 发布,经典 PHP Web 开发框架

symfony2的中文视频教程更新中(原创),对Symfony感兴趣的学员可以看下

Symfony框架

text 来自Codyhouse框架的Browserlist片段源代码