netbrothers-gmbh/nbcsb-bundle

使用单个命令创建 symfony 扩展包的骨架结构。创建目录结构和必要的文件,激活你的扩展包。查看:https://netbrothers.de/easy-create-reusable-symfony-bundle

安装: 699

依赖: 0

建议: 0

安全性: 0

星星: 4

观察者: 4

分支: 0

开放性问题: 0

类型:symfony-bundle

v3.0.0 2024-05-23 09:46 UTC

This package is auto-updated.

Last update: 2024-09-23 10:45:18 UTC


README

这是一个用于创建 symfony 扩展包骨架结构的命令行工具

  • src/ 下创建目录结构和必要的文件
  • 在 symfony 的 bundle.php 中激活你的新扩展包

你的扩展包的命名空间将是 App\[YourBundleName]

structure

安装

请确保已全局安装 Composer,如 Composer 文档中的安装章节所述。

使用 Symfony Flex 的应用程序

打开命令行,进入你的项目目录,执行以下命令

composer require netbrothers-gmbh/nbcsb-bundle

未使用 Symfony Flex 的应用程序

步骤 1:下载扩展包

打开命令行,进入你的项目目录,执行以下命令以下载此扩展包的最新稳定版本

composer require netbrothers-gmbh/nbcsb-bundle

步骤 2:启用扩展包

然后,通过将其添加到项目 config/bundles.php 文件中注册的扩展包列表来启用扩展包

// config/bundles.php

return [
    // ...
    NetBrothers\NbCsbBundle\NetBrothersNbCsbBundle::class => ['all' => true],
];

使用

打开命令行,进入你的项目目录,执行以下命令

php bin/console netbrothers:make-bundle [YourBundleName]

请注意,你的扩展包名称应以 "Bundle" 结尾 - 如 symfony 要求

# this is wrong !!!
php bin/console netbrothers:make-bundle Apple

# this is correct
php bin/console netbrothers:make-bundle AppleBundle

配置

如果你希望更改模板

  • installation/templates 下找到基本模板。将它们复制到任何你喜欢的位置。
  • installation/config/packages/netbrothers_nbcsb.yaml 复制到 symfony 的配置路径
  • 将你的模板路径插入到 netbrothers_nbcsb.yaml 中。
  • 清除 symfony 的缓存。

作者

Stefan Wessel,NetBrothers GmbH

nb.logo

许可证

MIT