Search code examples
phpmoduledirectory-structure

How to create a module-based php-application


I am quite new to php and are about to start developing a system that will be favoured by having a module-oriented design since new isolated/independet "services" will be added to the system over time. All will be tied together in a normal web-page where one menu entry represents one service. There may be several modules that different services use but each service will definitly need at least one of its own module.

What I would like to know is what the best practice is for creating php-application to which it will be easy to add new independent modules over time?

Thanks!


Solution

  • You can avoid much of the decision process by using a framework. The best practices were built into the better ones, including how to divide up your application and structure the files. If you are new to PHP, it could save you a lot of mistakes.

    These days, I see the leaders as Symfony2 and Lithium. Zend Framework 2 should also be good option when it finally comes out. There are dozens of them, but you might want to consider the quality of the documentation and the size of the community as a criteria. You are less likely to find an answer to a question on a framework that does not have a significant community.

    Keep in mind there will be a learning curve. For example, Symfony2 uses advanced concepts like dependency injection quite extensively. Great on modularity, bit harder to tackle at first.