创建一个Symfony应用程序:如何组织逻辑/bundle



我正在启动一个新的Symfony 3.4应用程序,以便为我们的小型企业创建一个文档管理平台。我想我知道如何在几个自定义捆绑包中组织我的所有代码,但我宁愿在这里寻求建议;)

下面是我脑海中的树:

---- MyCompany
-------- app
-------- bin
-------- src
------------ Custom bundle with UI / design elements ( = all the main templates / layouts for the app : header, footer, sidebar etc...)
------------ Custom bundle for User management ( = user management controllers, entities profile view etc...)
------------ Custom bundle for Product management ( = products CRUD, controller, entities, product page views etc... )
------------ Custom bundle for miscellaneous operations / tools
-------- tests
-------- var
-------- vendor
-------- web

这是启动应用程序的好方法吗?有没有其他方法可以做到这一点?谢谢!

是的,还有另一种方法。就我个人而言,我不喜欢将我的应用程序逻辑与我的框架耦合,甚至Symfony Best ppracticeices也不建议为您的应用程序逻辑创建多个捆绑包。

您可以只有一个捆绑包(AppBundle/ApiBundle(,并且您的逻辑组织方式不同(在您的捆绑包或其他文件夹中(。

最新更新