php - Which things to put in symfony bundles

73

I am new to symfony and my project is to build a complex web application in symfony.

There will be many small features like pdf export, xls export, document upload which can be used in future projects.

But I am not sure whether I should make separate bundles for pdf, xls, image upload or what.

All I want is that I can reuse the classes. How should I do this?

397

Answer

Solution:

Start with everything in one bundle. Especially if you do not plan to redistribute the bundle. Using proper separation of concerns when developing your classes will be enough reusability for any of your own projects. You can use namespacing within a single bundle to organize even more. Prematurely separating your project into bundles will add unneeded complexity and there's little, if any, advantage. Save it for a refactor down the road when/if the need for bundles becomes more apparent.

225

Answer

Solution:

It depends. There is some people who thinks that EVERYTHING goes into a bundle. Personally i think this is wrong, and that the right approach would be to develop small component and have bundles integrate them into the Framework, just like what FrameworkBundle, SecurityBundle etc. does.

For examples on small components you can checkout Vandpibe. Which is just small components/bridges for Symfony2 components.

http://github.com/vandpibe.

People are also looking for solutions to the problem: PHP how to truncate an array

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.