Plain PHP or Frameworks?

I’ve been wondering, why lots of PHP-programmers invent their own wheels (CMS, CMF, ORM etc.?), when there are a number of ready practices, ready PHP classes. Almost all typical tasks, that you can face to in web-development, have been already realized in the frameworks.

Let’s draw a simplified parallel. Just imagine that you need to build a house.

If you build it without any framework using plain PHP, you will get a formless hut, shaped of natural clay. Probably it turned out to be lasting, but once you need to make some changes into the construction, it will cause you much headache, and even small changes in one part of the house will entail negative consequences in the other part.

If you build it with clay, though with the help of previously developed special clay frames (your functions library), you will build the house faster. But don’t forget that, firstly, you will have to develop these frames, and it will take you not one year of hard work.

In this case the best option seems to build the house using store-bought bricks or even the whole slabs. PHP frameworks are associated either with ready bricks, or with slabs. In case of using slabs the house construction takes less time, though every so often you have to file them by sizes. There are some moments in case with bricks as well, but it is much easier to reconstruct the house, built from typical “bricks”. Though, firstly, you will have to study brick types, sizes etc. The same is with PHP frameworks.

There has been held a survey, according to which 40% of PHP developers either write in plain PHP, or do not use typical solutions, such as web development frameworks. Why don’t they? Let’s read, and analyze the comments of the respondents, to understand why so many programmers prefer to discover the continents again.

• “I’m lazy to learn something new”. The most popular answer. Well, I have nothing to say here.
• “I’ll manage everything by myself. I don’t need these frameworks”. Some programmers consider themselves to be genius, who will write a solid source, and debug faster on their own, than the whole community do.
• “I’ve already had my groundwork, which are completed as a framework. I just don’t have enough strength and time to publish them”. By the way, there are lots of such people. At the same time, your own solution will never be standardized, it will never be comparable with any of other products, and it is the programmer who develops it, who can leave his job later, and his solution will become the employer’s headache.
• “Frameworks are too slow, they are humongous”. Here we can say, that literate caching is the solution. Moreover, there is a possibility in smart frameworks, like Yii or Zend to optimize everything you need.
• “A framework doesn’t work with the latest technologies, like PHP 5.3, and I want to”. Well, in this case you can turn your attention to Zend Framework 2 and Symfony 2.
• “Frameworks are not universal”. I can’t understand this comment at all. Frameworks were thought to be universal tools. They are much more universal than CMS. Here is an example: there are 5 components in Symfony, ZF is modular from the very beginning, thus it is possible to change the structure, and even the components of the internal arrangement.
• “Frameworks are too universal, you will have to spend much time to adapt them”. And writing the code grassroots will take you less time? This is true only for small tasks, but once various demands appear, the customer changes the conditions, the design changes, and you have no architecture, then you understand that it would have been better to work in the framework.
• “Frameworks make the structure much more complicated”. That is not true, as framework gives you a carcass, set of tools. Naturally, you will have to spend some time to study how it works, but once you do this, you will see, how your work is simplified.
• “I don’t like exterior frameworks, on the reason I like writing in plain PHP”. Well, in this case, let’s write applications in assembler, why not? In my point of view, by saying this, some programmers just cover their reluctance to learn a new PHP dialect as a framework.
• “Oldclients, oldprojects. There is a need to support them”. If you are not able to persuade the client to pay for the transition (which is more likely to happen), then you have no choice but to support.
• “Frameworks are good to practice at the initial stage, when your experience doesn’t allow you to write more complicated things”. Consequently, they give you superiority in the speed of development that is really important. The understanding, why we need standards comes with experience.
• “Why do I need frameworks, if I have CMS, which is sufficient for me”. Probably, you don’t need a framework in this case. Though if CMS is not enough (new demands, specification changes), you’ll have to think the question over again.

Now, you, please, share your thoughts about PHP frameworks? I’m eager to read about your experience, because, as you know, the truth emerges while arguing 🙂


Nadya Klim

Business Development Manager


17 thoughts on “Plain PHP or Frameworks?”

  1. My $0.02: I probably can’t speak for most PHP programmers (I use .NET) but I have mixed feelings about frameworks. They are a great starting point in many cases, but we have so many clients that want custom functionality not part of the framework(s) in use. Because of this, we’ve run into trouble in the past because it’s more time-consuming to change the framework and figure out someone else’s methodology than to simply have created the custom solution for ourselves. I do love the HTML5 boilerplate and jquery frameworks, but for a CMS, almost all of our CMS solutions are custom-designed and allows us to add/edit/modify anything the client could every possibly want.

  2. I also love to use frameworks. But there would be some specific requirement from clients which requires more time (or not doable) in framework that being done by plain PHP code. For example, we need to introduce a new logic in pagination in a project done in Yii framework. It more time than it usually takes. Another issue is version change. If you had done a project using a framework, using latest technologies will become an issue. It may be available in latest version of the framework, but upgrading to latest version requires total structure change.

  3. On every project that i start, i always try to find solutions within frameworks at first and usually end up coding my needs from scratch because either it is badly coded or just doesnt meet my needs. There are some that i always use but i usually code my own stuff when it comes to custom needs.

  4. Personally, it is a matter of taste, experience and familiarity.

    A framework is nothing more than a collection of libraries, directory structure and coding conventions.

    There are no right or wrong answers.

  5. The lightest, most portable PHP framework I’ve used is CodeIgniter. For me, it doesn’t do everything, but it also gets me down the road with common tasks I don’t have to do every time. Plus, it’s blazingly fast if you use it right. 😀

    1. How can you say CodeIgniter is blazing fast? Have you actually done any performance tests? Because I did. Turned out that a basic CodeIgniter installation (just rendering the index file after installation) is from 12 to 20 times slower than I framework I wrote myself.

  6. Man, this is such a flamebait. For starters, the “Frameworks” you mention aren’t like bricks – they are prebuilt walls that fit together just nicely and only leave you to decorate the interior. But they only come in 5 different sizes. If you need to expand later (say you’ve been successful enough to attract a lot visitors) you’re restricted by the walls around you.

    And “literate” caching is not the answer to everything. In this case it paints over a fundamental problem of architecture you ought to fix at the source or it’ll just come bite you with added complexity later on.

    So while full-blown frameworks are nice in the beginning, you have to pay back the time it saved you when you later fight it’s quirks. And trust me, they charge interest that put investment banker’s greed to shame.

    IF, and only if, a framework provides you with bricks *you can rip out and replace individually* I’m actually gonna use it. I’ve been burnt by both Zend and Symfony trying to scale out and/or do things that are not in the manuals.

  7. Another – at least for me – very good reason to use a framework is the fact that it comes with many conventions which will help you and especially other people a lot to get into your code even after some time but @Matti is right: This is one hell of a flamebait 😉

  8. You do not need a Framework if you organize everything in a Alphanumeric order and use a Single Model Indexer. create a config and assign all your paths to variables —>$a1=(‘a1/a1a.php’); //equals a nice config file path. Next Grab Twitter-Bootstrap and design several pages for your apps home page, static pages, join, login, members profile etc. Then comment each div and or section start and end div tags to allow chopping it down into changeable page-parts. Next we create a alphanumeric file system to store all resources, views and controllers–> a1,c1,v1,r1,l1,i1,s1, For a Public(static) module. Next a2,c2,v2,r2,l2,i2,s2, for a Protected(members) module. Next a3,c3,v3,r3,l3,i3, for a private(admin) module. Next add new modules as 4,5,6,7 and so on. The folders organize the structure as a(configs, ini’s), c(controllers(classes and functions)), v(views(page-parts,in numeric order by headers(v1a-v4a), horizontal menus(v1b-v4b), left menu top(v1c-v4c), contents(dhome-all-dpagenames), right menu(v1e-v4e), and so on to the footer as v1f-v4f etc. Now we create a single index.php model and conditionally pass the actual page names and that’s it. Place all classes and functions in the c–controllers, place the views which echo the short tags data and or function tags, Route all links, GET data, and redirects through the indexer as index.php?page=home&id=$uid etc, css, and images too. I have a Full Bootstrap Version at Google Dev EssenceOne, I used it to create a entire social website with session members, and wall posting system with profiles and images and a messenger within a few hours. You won’t need to include or route anything between controllers and views as long as they are placed in alphanumeric order by $path variables within the indexer model,,,And the controller folders are placed in order above the views(page-parts-sections by sections) for auto inclusion. Example a profile page paths values in order by module–> c2/session_chk_user.php((redirect-above-header))), v2/header2.php, v2/hz_menu2.php, c2/profile_process_class.php, v2/user_profile.php((left-menu2)), c2/wall_post.php, v2/profile.php, c2/friends_list.php, v2/right_menu_frnds.php, v2/profile_footer.php etc. Can add multi levels simply by next alpanumeric order c1/c1a/c1a1/admin_class.php etc.Version 1.10 already has the global sessions and cookies files installed. Plus the single model indexer(index.php page)can be used to repair any project or any framework site by simply routing everything through the indexer list. It is no more a framework than it is a tool to teach the I.B.M.Dos-Tree way to deal with routing and mapping files using Php. I am working on a full CMS version now.

  9. We are currently having this discussion at work regarding whether we proceed with plain PHP as the majority of our web solutions are custom coded for our clients and to us it made more sense to code our own solutions.

    However we are increasingly looking at frameworks as use an analogy which was used right at the top of this article, we don’t want to constantly reinvent the wheel. To us it makes more sense to take advantage of the skills and experiences of codes behind frameworks which as symfony and laravel as a code base for what we do and we can take advantage of their pre-built functionality for things such as logins/form validation/mitigation again CSRF.

    It does make sense to uses these functions rather than constantly rewriting /copying and integrating the code for every new project.

  10. Not to butt in too much, but WordPress and Facebook Both do not use any Framework. And are both are at the Top of the scene respectively. WordPress for WorldNews ABC,CBS,FOX,etc. and Facebook for Social. Facebook takes good advantage of mixing Ajax with Php, and WordPress stays at the top of the News and Post sites. These Framework buffs are trying to re event the wheel, and some of their ideas are very good,, but hey, look how bulky they are. And they are taking in the cash on people trying to learn Php. Great websites do not come from Frameworks, they come from enthusiast like you and i who create new and exiting ways of mapping dynamic sites.

    1. Your comment was al the motivation I needed, frameworks limits someone a lot. when there is need for a new feature not in the framework or a framework upgrade…trouble comes knocking. I couldn’t imagine Facebook being built on a framework. Nice comment.

  11. Just to throw it out here. I am the developer of a huge web application that is used by many, many different people each day.

    And I can tell you from real world experience in a large scale environment; packaged frameworks are simply going to cost you in the long run.

    There are some uses for packaged frameworks.

    Say for instance – you are building a website for the local doctors office, nothing fancy, just a static site and you decide to use CI, good for you. This will probably mean that with twitter bootstrap you will be up and running in a few hours with something decent.

    If the site never grew or demanded services beyond CMS or an admin module, you would still be comfortable with your packaged framework.

    Now, consider that same office received a new medical technology and suddenly became a large enterprise, demanding web services and 3rd party RESTful Web APIs to interface their new technology, CMS, admin, patient login, payments, patient data, and more.

    Done considering?

    Now consider CI, ZF, SF, or any other packaged framework and decide your starting point. From there, unpackage your framework and get it all setup and get the basics going, because you know and I know that you can’t use that old crap that was static. So you rebuild a new UI, but you still need to integrate all these other moving parts.. now you have to learn your framework from the inside out, now you have to read docs and learn more stuff that will be out dated in three months. Good for you.

    While your doing all of that, I have already implemented my basic framework and started on the other moving parts, because I know my code, I know my framework and I know that you’re still stuck reading docs.

    Frameworks have their place, but not in enterprise development.

  12. While this is an older topic, I noticed that it was in a search result, so people are still reading and every once in a long while commenting, noticed lots of great reasons, but I noticed no one mentioned, one of the biggest reasons, why frameworks sometimes do not fit into a project, (at least I did not see this in the replies, (Licensing) many of these frameworks have copyleft (what I call JunkWare) its sad but true that many companies avoid many of these situations where they are exposed to licensing models that have not been tested legally, may not be legal or constitutional and in some cases are just downright ignorantly stupid.

    But I digress, the biggest reason many developers choose to roll their own environment is the simple fact that when you create it yourself you own it, you don’t have to worry about someone coming along later and saying your violating the copy left licensing give me all your code.

    LOL< anyway, great publication, great discussion, I like some of the frame works, but I have never found one that fits in with what I want to do 100 percent, )

  13. EssenceOne at it is more of a tool than a framework. Try it. It allows you to build dynamic Php websites fluidly using Alphanumeric naming.

Leave a Reply to Matti Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s