4 ms·
I've been working with php for about 10 years now. I have to say that I really enjoy frameworks. They make my job a lot easier. Before I started using framework
by f1gm3nt 16y ago
I've been working with php for about 10 years now. I have to say that I really enjoy frameworks. They make my job a lot easier. Before I started using frameworks I already built one of my own without realizing it.
To start off with I had my own classes to make tasks a little easier. Most php applications deal with a database of some sort, because of that I created a database class that helped me connect to a database and get the information I need. Same with templates. I used smarty since I didn't see a need in making my own. I had my own directory structure and config files for everything. When I was working on a site that needed something was usually when my 'framework' got updated.
Then I started reading about frameworks. I have used most frameworks in one way or another. The one that I prefer over other php frameworks is symfony (symfony-project.com). Why? They use doctrine as an ORM. They already have best practices built in. It's not as 'bloated' as other frameworks. Take CodeIgniter for example. Then go take a look at Kohana (which is a stripped down version of it). Once version 2 comes out they will have PHPUnit bundled with it. They use existing open source software instead of reinventing the wheel and making one for that framework only.
What is the benefit to you as a php programmer to use a php framework? There are a lot of things to take into consideration when creating a web application such as security. Are you escaping user input before you use that input in a MySQL query? What about user session management? There is more to consider, but hopefully you should get the idea. You start to see yourself repeating the same code after awhile so you start making classes or functions that make your job easier.
Should you use php without a framework? You can, but you will essential be creating your own after awhile. IMO it's best just to research a few different ones and find the one that best suits your needs since you can leave the framework development to other guys while you focus on creating a site. For me, symfony best fits my needs. Others may want to check out CakePHP or other frameworks. I never cared for Zend Framework, but use the zend library.