PHP Code Organization – Clever Application Structures

code-organizationfile structurePHPproject-management

There are a million-and-one file-system structures that go into the myriad of Open Source projects available. Things like modules, language files, domains, third-party libraries, migrations, internationalization, backups, and syslinks to other parts of the system have given rise to many approaches to organize the filesystem of a project.

As a PHP developer I'm wondering if any type of standardization is starting to emerge among projects. With PSR-0 we finally have a standard for naming and loading files – but it nothing to my knowledge about the rest of the components that make up the system or how they can be handled in a sane way.

We are dealing with a lot more than just MVC, so what examples are there of large projects correctly handling all of these things?

Best Answer

It isn't really possible to standardise how projects should be laid out, because "it depends".

If you introduce a standard structure, but some of it isn't relevant to the requirements being developed, you can end up with additional noise that you don't need. Similarly, if the standards need to work for a wide range of projects, they will need to incorporate too many disparate scenarios.

Our job as developers is to look for patterns and best practices and apply them to the task in hand. We use our experience and expertise to choose the right file system structure for the project we are working on.

Related Topic