What projects are suitable for PHP frameworks?

I create a site like SO using PHP as a personal project. I started writing flat PHP files (view with SQL queries mixed with HTML). Having done a few pages, I noticed that it is difficult to maintain. So I started using ORM (Propel). Then I met Symfony.

I started refactoring my code to fit the Symfony MVC pattern. It seems to me that for a small project such as this Symfony actually complicates the situation, and I actually develop more slowly. Are the frameworks more focused on large applications developed by several teams? Or am I doing something wrong?

+4
source share
3 answers

Any infrastructure or new technology will have a learning curve, during which you seem to be slower. If you follow the MVC pattern and best practices for your structure, you will usually get cleaner and more convenient code. For MVC, there is some overhead and a good structure. These overheads will be more advantageous for large projects, projects that last longer (website life span, as well as development time) and for projects with a large number of developers. For small sites that will not be supported, the overhead may be too large to be useful.

If you intend to write PHP professionally, or if you intend to write seriously, your time is well spent exploring a popular structure or two.

Also, in no way is a "site like SO" a "small project".

+6
source

It depends on the structure and how you want to easily develop development in the future with the speed of development in the present. The best way to get to the end is to try several frameworks and see what suits you best. A few random examples include:

I used all of the above, and I personally found that Agavi was the best, although, of course, not the fastest to work. I was not so impressed with the cake, like everything else, but again, this is a personal preference.

+1
source

I donโ€™t know how โ€œsmallโ€ your project really is, but even if you need time to study the structure and design your project, it follows the framework philosophy that it usually costs.

In my experience, when projects start to grow, as your project seems (naive PHP โ†’ model factoring โ†’ ...), you end up in code very similar to a simple structure. When you use the framework, on the other hand, the basic design of your project is usually very thoughtful, so even if you are not an experienced software architect (maybe you?), You will get a good foundation for your project.

In addition, you say that this is a personal project, so I assume that this is a kind of hobby or an educational thing. Using a framework can be a good way to learn about design patterns and best practices for web development.

Symfony may not be the best choice for you. In the end, it is a matter of personal opinion. Personally, I like CakePHP when coding PHP and Django when coding in Python.

0
source

All Articles