首页 > 代码库 > php_Symfony_项目实战全过程记录

php_Symfony_项目实战全过程记录

 

今天是2017年1月8号,正式接收到一个Symfony 的项目,准备全程记录遇到的问题及解决方法,之前被通知学习该框架,只是一直没有机会做项目,今天终于可以做了,希望2017把Symfony学的能会使用,能够解决基本问题,能够独立新建项目。。。。。2017开始了。。。。。。。。

 

-------------------------------------------------------------------------------------------------

1月8号,更新代码,由于有两三个月没有看symfony了,上来就遇到了之前的问题,幸好遇到过(以下XXX代表项目名称)哈哈

1:更新代码。。。。。

2:跑项目

问题如下:

$ php bin/console server:run
PHP Warning:  require(D:\home\workspace\XXX\app/../vendor/autoload.php): f
ailed to open stream: No such file or directory in D:\home\workspace\XXX\a
pp\autoload.php on line 7
PHP Fatal error:  require(): Failed opening required ‘D:\home\workspace\XXX
\app/../vendor/autoload.php‘ (include_path=‘.;D:\php-5.5.30-nts-Win32-VC11-x64pear‘) in D:\home\workspace\XXX\app\autoload.php on line 7

解释:没有安装依赖包

 

问题解决:执行$ php cocomposer.json  composer.lock  composer.phar

 

运行后如下:

 

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 33 installs, 0 updates, 0 removals
  - Installing doctrine/lexer (v1.0.1) Loading from cache
  - Installing doctrine/annotations (v1.2.7) Loading from cache
  - Installing twig/twig (v1.28.2) Downloading: 100%
  - Installing symfony/polyfill-util (v1.3.0) Downloading: 100%
  - Installing paragonie/random_compat (v2.0.4) Downloading: 100%
  - Installing symfony/polyfill-php70 (v1.3.0) Downloading: 100%
  - Installing symfony/polyfill-php56 (v1.3.0) Downloading: 100%
  - Installing symfony/polyfill-mbstring (v1.3.0) Downloading: 100%
  - Installing symfony/symfony (v3.2.1) Downloading: 100%
  - Installing symfony/polyfill-intl-icu (v1.3.0) Downloading: 100%
  - Installing psr/log (1.0.2) Loading from cache
  - Installing psr/cache (1.0.1) Loading from cache
  - Installing doctrine/inflector (v1.1.0) Loading from cache
  - Installing doctrine/collections (v1.3.0) Loading from cache
  - Installing doctrine/cache (v1.6.1) Loading from cache
  - Installing doctrine/common (v2.6.2) Downloading: 100%
  - Installing jdorn/sql-formatter (v1.2.17) Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.0) Loading from cache
  - Installing doctrine/dbal (v2.5.5) Loading from cache
  - Installing doctrine/doctrine-bundle (1.6.4) Loading from cache
  - Installing doctrine/instantiator (1.0.5) Loading from cache
  - Installing doctrine/orm (v2.5.5) Loading from cache
  - Installing incenteev/composer-parameter-handler (v2.1.2) Loading from cache
  - Installing sensiolabs/security-checker (v4.0.0) Loading from cache
  - Installing sensio/distribution-bundle (v5.0.15) Downloading: 100%
  - Installing sensio/framework-extra-bundle (v3.0.16) Loading from cache
  - Installing monolog/monolog (1.22.0) Downloading: 100%
  - Installing symfony/monolog-bundle (3.0.1) Downloading: 100%
  - Installing symfony/polyfill-apcu (v1.3.0) Downloading: 100%
  - Installing swiftmailer/swiftmailer (v5.4.4) Downloading: 100%
  - Installing symfony/swiftmailer-bundle (v2.4.0) Downloading: 100%
  - Installing sensio/generator-bundle (v3.1.2) Downloading: 100%
  - Installing symfony/phpunit-bridge (v3.2.1) Downloading: 100%
paragonie/random_compat suggests installing ext-libsodium (Provides a modern cry
pto API that can be used to generate random bytes.)
doctrine/doctrine-cache-bundle suggests installing symfony/security-acl (For usi
ng this bundle to cache ACLs)
sensio/framework-extra-bundle suggests installing symfony/psr-http-message-bridg
e (To use the PSR-7 converters)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages
to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages
 to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an A
MQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a M
ongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log message
s to a GrayLog2 server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages
to a MongoDB server via PHP Driver)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log m
essages to an AMQP server using php-amqplib)
monolog/monolog suggests installing php-console/php-console (Allow sending log m
essages to Google Chrome)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages
to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages
to an Elastic Search server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to
 a Sentry server)
Generating autoload files
> 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.

 --------- ------------- ----------------
            Bundle        Method / Error
 --------- ------------- ----------------
  WARNING   XinXiBundle   copy
 --------- ------------- ----------------

 ! [NOTE] Some assets were installed via copy. If you make changes to these
 !        assets you have to run this command again.

 [OK] All assets were successfully installed.

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFi
le
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarg
et

 运行中以下部分是要输入的:但是我都默认的回车,过一会再研究

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):

 

php_Symfony_项目实战全过程记录