创建Symfony应用程序:如何组织逻辑/包

时间:2018-01-09 09:18:13

标签: symfony symfony3.x symfony-3.4

我开始使用新的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

这是启动应用程序的好方法吗?还有另一种方法吗? 谢谢!

1 个答案:

答案 0 :(得分:2)

是的,还有另一种方式。我个人不喜欢将我的应用程序逻辑与我的框架结合,甚至Symfony Best pratices也不建议为你的应用程序逻辑创建多个bundle。

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