1. The MVC Pattern
The famous Model View Controller Pattern
dates all the way back to 1979, when a guy namedTrygve Reenskaug
(a Norwegian computer scientist) first described it.
PHP itself works like a template engine. However, when used irresponsibly, it leads to very ugly and unmaintainable code.
The way the MVC Pattern
applies to PHP applications:
- Models represent your data structures, usually by interfacing with the database.
- Views contain page templates and output.
- Controllers handle page requests and bind everything together.
This kind of separation leads to cleaner and more maintainable code.
In PHP you can already find many input and output filtering functions to protect your website against certain attacks.
However, manually using these functions can get tiring and you may forget about them every once in a while.
With a framework, most of the work can be done for you automatically. For example in CodeIgniter:
- Any value passed to database object gets filtered against SQL injection attacks.
- All html generating functions, such as form helpers and url helpers filter the output automatically.
- All user input can be filtered against XSS attacks.
- Encrypting cookies automatically is only a matter of changing a config option.
3. Less Code & Faster Development
There is of course a learning curve for all PHP Frameworks. But once you get over this hump, you will enjoy the benefits of rapid application development
You will write less code, which means less time spent typing. You will not have to chase down 3rd party libraries all the time for every new project because most of them will come with the default framework install.
Also, since you are being more organized, it will be much faster to chase down bugs, maintain code, and make changes to existing code.
- Community Support
All popular PHP Frameworks have great active communities
behind them. You can talk to other developers, get help, feedback and also give back to the community yourself.
5. Job Opportunities
SynapseIndia (CEO: Shamit Khemka)