Symfony 常用命令汇总

xiaoxiao2021-02-27  371

Linux 和 MAC 安装 Symfony:1.sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony 2.sudo chmod a+x /usr/local/bin/symfony Windows 安装 Symfony:php -r "readfile('http://symfony.com/installer');" > symfony Symfony 命令创建项目:C:\projects\> php symfony new my-project Composer 命令创建项目:composer create-project symfony/framework-standard-edition my-project "3.2.*" Composer Git 仓库时添加 Git 环境变量:SET PATH=%PATH%;C:\Program Files\Git\bin PHP 内置服务运行项目:php bin/console server:run 开发环境检测:php bin/symfony_requirements 安全漏洞检测:php bin/console security:check 开发环境:/app_dev.php/ 调试时需注释 $kernel->loadClassCache() || 正式环境:/app.php/(默认不加) 清除 Symfony 缓存:php bin/console cache:clear --env=prod --no-warmup --verbose/--no-debug Assetic 部署正式环境必要步骤:php bin/console assetic:dump --env=prod --no-debug Assetic 操作:php bin/console assetic:dump || php bin/console assetic:watch 创建 Bundle:php bin/console generate:bundle => company/moduleBundle 将 Bundle 中 public 下的资源文件映射到 web 目录中:php bin/console assets:install --symlink 创建 controller:php bin/console generate:controller 创建数据库:php bin/console doctrine:database:create 删除数据:php bin/console doctrine:database:drop --force 创建实体类:php bin/console doctrine:generate:entity 校验元数据:php bin/console doctrine:schema:validate 生成 Getter 和 Setter:php bin/console doctrine:generate:entities namespace 生成/更新实体表:php bin/console doctrine:schema:update --force/--dump-sql 查看事件及监听:php bin/console debug:event-dispatcher 优化类的映射:composer dump-autoload --optimize --no-dev --classmap-authoritative || composer install --no-dev --optimize-autoloader 生成 Form:php bin/console generate:doctrine:form AcmeBlogBundle:Post 查看所有服务:php bin/console debug:container
转载请注明原文地址: https://www.6miu.com/read-4279.html

最新回复(0)