By Akash Mehta

Last we checked, PHP IS a framework.

By Akash Mehta

When it comes to web programming languages, PHP probably holds the record for copping criticism from the community at large. Comparisons with alternatives such as Ruby on Rails and Python/Django are common; defenders of PHP are quick to criticise the comparison of a language and a framework. But at the end of the day, developers work with Ruby on Rails, and with Python/Django, and with PHP. Just PHP. For most of the PHP applications out there, the language is just perfect, because PHP, to an extent, is the framework.

PHP is designed for the web. You could plug vanilla Ruby or Python into a web server and get up and running pretty quickly. But, at least at a basic level, you’d want a framework to deal with common issues of web development. In PHP, you just get started. PHP and Apache work out request data, output handling and more, right out of the box. (PHP also masters deployment.) David Heinemeier Hanson, the creator of the Ruby on Rails framework, calls this the immediacy of PHP.

Now, consider the “average” PHP frameworks. They help you handle request data, manage your output, control app flow – essentially, extending PHP’s inbuilt functionality. They are, therefore, PHP frameworks on the PHP framework. PHP provides a vast array (pardon the pun) of functionality out of the box. But when you want to do things your way, it gets out of the way, and this is really important when building anything beyond a simple database frontend.

How many PHP applications in wide distribution are built on a third-party framework? MediaWiki? No framework here. WordPress? Not here either. Drupal? You get the idea. Each of these applications have their own framework, inasfar that the developers built a structure for their code that suited what they were trying to create. These three, and the countless others, clearly did something right – MediaWiki even powers one of the world’s top 10 websites. And when building these “frameworks”, PHP helped them along the way.

Sure, Cake, Symfony, CI – they all help you build PHP applications. But unlike a Ruby framework or a Python framework, coding is perfectly tolerable without them. Of course, most developers tend to create their own framework as they go along – I call this PHP’s DIY framework mentality, where you build the last level in your stack, and by extension you know exactly what’s going on under the hood.

This comes back to the oft-cited “best tool for the job” argument – but by being a “half framework” of sorts, PHP simply helps you within a web context. I’m sure Rails is great for countless applications; Ruby syntax helps a little too. But beyond the basics, the language becomes increasingly irrelevant, and a framework will force you to build your app according to design decisions made by the original developers. On the other hand, PHP allows you to quickly put together your application the way you want, helping you with the web-based aspect, and without having to break the language/framework to achieve your goals. Essentially, PHP is the web layer without the framework baggage.

Twitter recently had some downtime that could be attributed to its use of Ruby on Rails. Now, there’s nothing wrong with Ruby, or Rails. But Twitter is a messaging system, RoR is an application framework. Could Rails be worked around to suit Twitter? Maybe. Could Twitter have avoided these problems if they’d used PHP? Probably. Twitter’s developers have noted they weren’t quite expecting the site to be so succesful. If they had built it in PHP, they would probably have encountered other (similar) problems earlier on, rewritten the entire app while it was still feasible, and built a powerful system that could scale just fine (likely with the messaging platform in C). Using PHP could have helped, not as a language with syntax and libraries as such, but as a web development platform that gives developers the freedom to architect their systems as they want. (They could also have tried Erlang.)

So the next time you’re on the lookout for a PHP framework to build your killer app on, consider using the best framework of them all: PHP. It will give you the freedom to achieve what you want, how you want, with results. A quick hack? Check the manual, it could be a one-liner. A massive distributed messaging platform? Full steam ahead, build it your way. For everything in between, there’s a multitude of options, but if you have the time, PHP is all the framework you need.

  • Kyle

    I’m sorry, but I can’t stand any more inferiority complex from PHP coders. PHP is no more a framework than Perl is a framework. Calling PHP a framework does disservice to both PHP’s core and the true frameworks that are built upon it. PHP is a full-bore programming language, and we need to stop apologizing for how flexible, forgiving and relatively easy to use PHP is.

  • Interesting post. I think many of the points you make about PHP being the framework as well as the language apply equally well to ColdFusion – and yet I still think that frameworks have their place. But my comment ended up being so long and ranty I posted it on my own blog: Another angle on the frameworks debate.

  • I disagree. PHP is NOT a framework, it is just a language. The big difference between PHP and other languages is that you do NOT need to use any sort of framework before you can start producing working applications.

    Some languages, like Visual Basic, come with a framework that is built into the IDE. You cannot build, compile and run a VB application without going through its IDE, but with PHP all you need is a simple text editor and nothing else.

    A language allows the developer to do whatever he wants within the constraints of the functions which are supported by that language and without imposing any design decisions. A framework is something in addition to the basic language that simplifies certain complex or repetitive functionality, but only if you follow the design decisions made by the framework author(s). That is why in some languages there is a wide choice of frameworks as they were designed by different people to provide different levels of functionality.

    PHP is not a framework, it is a language. Ruby is a language, Rails is a framework.

  • @Kay: I think ColdFusion fits the description even better than PHP; ColdFusion is sort of a complete integrated platform with certain requirements on the stack as well.

    “Frameworks” – CakePHP, Symfony, ZF etc. – are helpful for the middle ground of applications; I consider that no really large-scale PHP-powered sites use third-party frameworks; they all roll their own. Facebook certainly isn’t using Cake, PHP gives FB and others the freedom to very easily build the structure that works for them, and the same for all the other major sites.

    @Tony: Well, let’s consider what a framework is. A language consists of the syntax, the engine, maybe the core functionality that the language ships with. In PHP, everything else is an extension. Wikipedia states that a framework “solves problems for a given domain and provides a simple API” – isn’t that what the libraries that ship with PHP do? Sessions are a good example; PHP overcomes HTTP’s statelessness by providing the Sessions extension. It’s not a core language feature, it’s just a standard extension that aids web development, and it’s these extensions that make up the PHP framework I’m writing about.

    PHP does enforce design decisions – for example, you must have a file that serves as your application entry point. My post was about how few design decisions PHP enforces, making it quite possibly the most flexible “framework” around. (In, say, C, your main() function is your entry point – which is also a design decision.)

    By the way, I’m sure you can use the VB compiler without the IDE (certainly back in the days of version 6); however, you’d have to learn the syntax for the form designer files. VB code (including the form code) is stored in plain text files as well, and the IDE just runs it through the compiler much like Dev-C++ or Code::Blocks.

  • @ Akash Mehta

    The defintion of a framework which you quote is too vague as it could apply to any language. It implies that every language is automatically a framework, which it is not.

    You say that PHP enforces design decisions in that you must have a file that serves as your application entry point. This is not a design decision, it is a simple fact of life that applies to every language ever written. A “design decision” is where there are several different ways to achieve an objective and you have to decide which one to implement. The fact that every application must have an entry point does not involve a choice, therefore there is no decision to be made.

    The fact that PHP comes with a lot of extensions still does not make it a framework – they are simply additions to the core functionality. A true framework provides access to complex or repetitive functionality without the programmer having to write reams of code. For example, to create an HTML document you can do it without a framework by constructing and echoing a series of strings, which can be quite complex and time consuming. Or you can use a framework where the programmer never has to write any HTML as it is all done for him with something like XSL transformations.

    While it may be techically possible to write VB applications without the VB IDE, how many people do so? The simple fact is that there is only one VB IDE, and that IDE was designed to work in a particular way.

  • Matt Wilcox

    Not to put too fine a point on it, but this article is:

    1) inaccurate
    2) pointless as far as I can see

    PHP is not a framework, Tony is absolutely right. Please don’t go talking as though it is, the idea of frameworks and how they differ from languages is hard enough for newbies to figure out without muddying the waters with this sort of article. Just because PHP was designed to make programming for the web easy doesn’t make it a framework. Tough cookie if people prefer Ruby, or Python, or any other language that wasn’t designed with the web in mind. Those people with those languages will want to use a framework to get the same ‘immediacy’ as PHP offers for web applications. But just because PHP offers similar immediacy as the frameworks of other languages does not mean that PHP is itself a framework.

    Using your logic you could call any language apart from assembly a ‘framework’ because they all are built on top of another language or interpreter and merely provide quick and easy access to functionality that is harder to do with a language lower in the stack.

  • FA

    This article should include a real example.

    Ok, so the dictionary definition of Framework is broad, but in the real world, when we are talking about web frameworks, we mean a series of integrated components and conventions that provide a proven and approved method for defining objects such as object models, interactions such as database access and object mapping, and abstracting the request-response process through a pre-defined process. These are common application problems, not language/file-level problems.

    PHP was not intended to solve architectural problems like these. It has no in-built understanding/configuration/conventions that allow any automatic wiring of design patterns. Any abilities in PHP that look similar to abstracted framework functionality are there by coincidence. PHP does not suggest a model for abstracting database objects, for request logic or for most other design patterns. I think this detachment from an implied framework is a strength.

    When you choose a framework, you are selecting a “way of doing things” as well as a set of tools you want to use (pre-build modules, code generators, tiered integration etc).

    Most frameworks are flexible enough to allow a developer to wire the request process flexibly – there is absolutely no reason that RoR could not have provided a performant messaging architecture. Perhaps not the “most” performant when compared to a “no-framework” approach if they choose to use the ActiveRecord – but this framework ic consructed to allow the developer to write/choose alternate components at will.

    There is no real comparison between PHP and RoR. There is no need to use RoR if you want to construct a website with Ruby. Choose RoR if you like Ruby, and the flexibility and style of that framework floats your boat.

  • Anonymous

    How many PHP applications in wide distribution are built on a third-party framework?

    Well, all the applications you quote started much before any PHP decent framework was out. Fact is they all started with the idea of being a framework (applied to some domain) which is one of the reasons they became so popular.

    It probably fits even better because ColdFusion, which predates both PHP and ASP, was designed with speed and ease of development in mind

    PHP was designed with same goal but with definetly less impositions on the developer.

    Of course, ColdFusion has a very healthy frameworks scene whereas I get the feeling frameworks are not as widespread or popular in the PHP universe

    Mmmm…I wouldn’t say so. Since PHP5, frameworks have been springing everywhere. Checkout
    to get an idea.
    The need for a framework has always been debated among PHP coders.
    Community replied in its typical fashion which to some extent is the strength of PHP. Not to mention Zend framework.

    But beyond the basics, the language becomes increasingly irrelevant, and a framework will force you to build your app according to design decisions made by the original developers

    This is a good thing when you have a good framework. You want predictability by a framework. So this is what you get.
    If the framework itself becomes the show stopper you are left with only a few options:
    1) you chose the wrong framework
    2) you are not using the framework to its potential
    3) you application design is wrong

    As for big sites using thirdy-party frameworks it is probably only a matter of time. Check out what Yahoo does with symfony. The fact they customised it only speaks in favor of symfony being an extensible and customizable framework unlike others.

    Are third party frameworks necessary for building big sites?
    No, if you roll your own framework and document it.

  • Obviously when engaging in “programming language wars” everybody will defend your favourite one, or the one you’re most skilled in…

    I’m not a professional programmer… but do project management with professional programmers. C used to be my language of choice in the pre-Web days, but for the past decade, I “switched over” to PHP… just because it’s a familiar syntax.

    As time passed by, gazillions of new languages popped up into existence, as well as millions of so-called “frameworks”. Old-school programmers, however, were ready to assemble what I call their “toolkit” — a set of libraries, routines, templates, and readily reusable code that they would infinitely copy & paste in all their projects to do their work. PHP, coming straight from its C inheritage, definitely encouraged this approach of code reuse.

    PHP’s inclusion as an Apache module started to change the way we thought about CGI late in the last century (yes, I know, getting PHP out of Apache and into FastCGI is the norm these days). Suddenly, the concept of a “Web Application Server” (as opposed to a Web Server) based on Apache started to emerge, and PHP fans were quite at the forefront of the development there. These days, we think on “web servers” as basically a client-server application that happens to spew out HTML+Javascript as an interface. Naturally there are several alternatives — but PHP was the first to create that notion.

    Rogue, young programmers are fond of “reinventing the wheel”. PHP allows them to do that every time they open their favourite editor and start writing code. Mature, professional programmers prefer a tidy codebase upon which they develop their applications quickly and efficiently, using testes code, proved in the field. PHP is quite good at that as well. System administrators worry about performance, stability, and robustness of their servers (software development doesn’t exist in a vacuum). This means that you have to figure out how much of your “development environment” has to be tied into the system and its architecture; tweaking caching and performance enhancement options. While things like Python and its marvellous compile-on-the-fly method are great, PHP has a vast array of options. C system libraries are exposed to PHP programmers. PHP compiled extensions can be included easily into the environment (and they’re high-performant C-compiled code too). External PHP interpreted libraries can be added at will, using PEAR or similar environments. Xcode and other tricks can be used to accelerate the just-in-time compiling performance of PHP scripts and keep that code in a cache. PHP’s notion that you can self-evaluate a PHP script allows you to store PHP code in database caches and retrieve it later. You can assemble snippets of PHP code from several sources and run them together (and JIT-compile it, and cache it). And mature libraries like Smarty also allow quick prototyping with built-in cache mechanisms.

    And finally… it’s definitely the Web-based programming language that has the largest amount of programmers around (meaning it’s easy to replace that lovely hacker with their obscure code…) as well as the most interesting and expandable applications, open source or not.

    From a business perspective, the choice is often hard. You can go to a “framework” that is fashionable and developed this year, and get eager programmers to do a hugely complex application in half the time it takes to do it in PHP — and it will even look clean, shiny, and bright. Then the problems start. How do you maintain it? Does the programmer have experience in developing for web sites with millions of page views per day? Who does support the fancy programming language/framework? Will the company be out of business next year as Yet Another Framework is launched? Or will it be bought by Microsoft and dumped in favour of .NET — forcing you to migrate? Will you manage to hire new programmers once yours quit and leave the project undone? New, bright, shiny frameworks are all nice at the short term, but long-term, how can you be sure they will be still supported?

    In the past, software engineers were taught that an application/software/framework started to become mature once it had a decade of developers eagerly using it. PHP definitely fits that concept, but it does more: it actually is one of the latest spin-offs of the C family branch, and no matter how much programmers might hate it, the simple and straight fact is that we have been training C-derivative programmers for over 35 years now. So if your PHP expert drops out of the company, get an old, seasoned, mature C programmer on board, and point them to They’ll start coding in no time (probably complaining all the time about the lack of a decent debugger and weak types, but this will also change with PHP 6.0…), assemble their own “toolkit”, and replace your programmer with ease. That is currently what appeals to me most on PHP: its longevity, even if it’s not “shiny, bright, and cool” like more modern programming languages or frameworks.

    For successful long-term projects, however, that’s what counts. And that’s why I continue to stick to PHP and encourage my teams to do the same, no matter how much they grumble and complain about “better alternatives”…

  • Brian Moon

    *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap* *clap*

    Good post.

  • markus

    I dont agree on several points – but I guess you expected this. :)
    Also I am an ex-php user who uses ruby these days (actually, since 4 years… php since 6 years)

    But my main point where i AGREE with you is this here:

    “But beyond the basics, the language becomes increasingly irrelevant, and a framework will force you to build your app according to design decisions made by the original developers.”

    Of course as a language, ruby is a lot better than php. But I agree with your statement here.

    And this is why I always tell the ruby people to improve ruby’s www feel _outside_ the rails camp, because every rails solution is so tightly tied to rails, that _I_ dont want to be forced USING rails.

    I’d rather much see ruby being used like php on the web.

    Simply _because_ ruby is a much better language.

    I hope the VM stuff will make a big difference. The speed of ruby 1.9 already leaves php behind.

  • visudo

    I think you are overstating the “immediacy of PHP”, or at least assigning it to a more specific category than it belongs. When something needs to be on the web yesterday, PHP is a good choice because you don’t have to plan ahead. You can “just build it”. This is an attractive prospect to all programmers, who are generally impatient folk, many of whom see pre-development design as a distraction.

    I worked with PHP for many years, and I still appreciate its ease of use. However, I think Python and Ruby are important players in the web app arena. Ruby has been sadly pigeonholed into Rails, but the fact is, both Python and Ruby have thriving communities based on building web applications without CGI boilerplate. For example, by using two tools called “rack”, a webserver abstraction layer inspired by Python’s wsgi, and “erubis”, a templating system, Ruby can quite easily be programmed “like PHP”. The same pair of tools can be a basis for a “DIY” framework that is built in parallel with the application.

    Ruby and Python, being object-oriented languages from their core (as opposed to PHP’s afterthought support), will generally force you to think about your application in OO terms. This makes getting started extremely difficult compared to PHP, because you have to, well, THINK!

    It’s true that I think Ruby and Python are better choices for pretty much any web application out there, but it isn’t because I hate PHP or think it’s a bad language. I see PHP as a temptation: “It’d be so easy.” However, the right path and the easy path rarely coincide, and once you get rolling with Ruby and Python web app tools, things can really start to come together.

    mod_php is a huge advantage, especially because mod_ruby is a sad joke. (I don’t know about the state of mod_python). Python and Ruby offer many choices, and it’s a double-edged sword. If you want to program a web app in PHP, you open a PHP file and start coding! In Py & Rb, there are many more choices to make, and it’s difficult and intimidating, but IMHO, ultimately worth it.

  • phpimpact

    Gwyneth Llewelyn, excellent post.


    Rails was good 3 years ago, now we have better frameworks. You know why no one ever compares Rails with Django or Zend Framework? That’s right, because they don’t want people switching to Django or Zend. Instead, they compare Rails with PHP and Python. Confusion is a powerful tool, if you know how to use it. Believe me, I’m part of the Ruby community as well.

  • Not to be an ass, but this is one of the most biased articles I have ever read, ha ha. You clearly do not understand programming. Twitters problem is not the language, its the programmers. A language is merely a tool. Both PHP and rails could run twiiter just fine if used properly. The difference is that rails can get you there quicker, especially for complex projects such as twitter.

    If PHP is a framework then every programing language in the world is a framework. the point of a framework is to allow you to focus on your application specific code. Not have to recreate the wheel every time you start a new application. It also lets programmers work in unison instead of having hundreds of programmers writing a library that all do the same thing. Under that definition PHP is NOT a framework.

    Also, it doesn’t matter what language you use to build twitter. In order to build the app properly you have to actually think about what you are doing instead of following step by step tutorials. My guess is that had twitter been built on PHP the developers might quite possibly still be working on things that are already done in rails.

    Let’s also keep in mind, it is possible to restructure a data base. People act like it’s this huge feat, it’s not. Restructure the database, map the old data to the new database, shut down your site at 4am, migrate to the new db. Start your app back up. Done.

    Trust me, twitter has done this many times. Their DB structure would not be any different under PHP.

    Everyone thinks the language they write on would be the solution to twiiters problems. The fact is that it doesnt matter what language you use, as long as you use it well.

    I have to say though, this is by far one of the worst articles I have ever read on sitepoint. I feel like I’m reading a 15 year old’s blog that has only programmed in one language. He doesn’t want to take the time to understand other languages so he just writes articles about how his language is the solution to every programming problem in the world.

  • Anonymous

    Bore of saying the same thing but really the unfortunate thing is most of the developers overlook the real power of PHP – simplycity – yet powerful. yes you can develop a simple system to complex application using PHP with same ease and rarely you need to be concerned about the environment.

  • Marco

    @Ben Johnson, a framework doesn’t have to adhere to the DRY philosophy.

    I don’t think calling PHP a framework is correct, but if you use PHP you probably also use a framework.
    PHP just makes it really easy to design your own framework, and make it more suitable for your needs, and just maybe, it might even save you time, or have other advantages compared to RoR or Django! It all depends on your specific needs.
    There are plenty of class libraries, template and caching engines around as well, that you can use to “put together” a costum framework in no time, and the fact the they exist as independent projects sometimes even help because they are better documented.

  • Anonymously


    I think you commented on the wrong article, this is not the “Twitter failed because of Rails” post :)

    Rails is not a programming language, it’s a framework; an outdated version of Django if you ask me. Also, Twitter’s new architects are migrating all the back-end stuff to java and c++, so that proves you wrong. The only thing you got right is that PHP, indeed, it’s not a framework.

  • Anonymous

    Cool. Java is a framework? A brick is a framework for building a house?

    Both of which are more than accurate using your definitions..

    Hell, C is a framework, meaning that PHP was written in a framework! zomg!

    Everything is a framework!?

    Sitepoint seem to either be getting lazy or desperate with this one.

  • Daniel0

    #include <stdio.h>

    int main () {
    print "Hello Worldn";
    return 0;

    There you go. According to your blog posts, C is now a framework because it handles output to the screen for me. So are all other languages.

    Furthermore, you said this:
    “[…] and a framework will force you to build your app according to design decisions made by the original developers.”
    Since when has PHP ever forced design decisions on me? I’ve seen a lot of PHP crap code where it’s evident that application design hasn’t been considered at all.

  • Berry Delicious

    Cool. Java is a framework? A brick is a framework for building a house?

    Both of which are more than accurate using your definitions..

    Hell, C is a framework, meaning that PHP was written in a framework! zomg!

    Everything is a framework!?

    Sitepoint seem to either be getting lazy or desperate with this one.

  • Daniel0

    Okay… apparently my code example broke and I can’t edit it, but you get my point…

  • I remember reading a post on the SitePoint forums about choosing a language to learn web development in. One of the forum regulars pointed out that Ruby or Python on their own would not be a good choice for a beginner, as one would need to handle a lot of fundamentals of web development – printing HTTP headers, parsing the query string, processing POST data etc. In Ruby or Python, you would use a framework to take care of this for you. In PHP, it’s all taken care of (thanks in part to mod_php, of course). PHP would never be a framework at application level. But it’s certainly that layer around your application that takes care of domain-specific tasks (in this case, web development) at a lower level.

    @Gwyneth: Thanks for your insightful comment. I agree entirely; I think you’ve hit the nail on the head as to the key advantage (and disadvantage) of PHP. I actually started with C++, although I’ve done VB, Java and Python.

    @visudo: I appreciate you prefer Python and Ruby; there’s nothing wrong with either language, and in fact I think Python has a great future ahead of it. You also hit the nail on the head re: Ruby – “Ruby has been sadly pigeonholed into Rails”. Ruby has a somewhat higher barrier to entry for writing web applications, and doesn’t seem to have quite a thriving ecosystem as we’d expect for a language older than PHP. As Ruby also isn’t built for the web, there are a number of challenges to Ruby web development that the PHP world never gave a thought. It’s simply the right tool for the job, and if you want to build an application quickly, build it in Rails, but as you get more and more complex you’ll find yourself running up against the limitations and breaking it to suit your needs. PHP frameworks are exactly the same, except that in PHP you’d drop the framework very early on; in Ruby, there aren’t very many alternatives to Rails and writing your own framework has a number of other challenges. I find PHP developers have learned to work at a lower level; high level development suits RAD, but that extra level of control is important for complex architecture.

    @Ben: Thanks for your comment. In the post (and in an earlier comment), I note that PHP as a “framework” enforces barely any design decisions, and as such is a very flexible “framework”. As we’ve seen from this comment thread alone, nobody really can define “a framework”, but if it helps you focus on your application specific code, then PHP qualifies. Per my example at the beginning of this comment, if you write web apps purely in Python, you have to worry about HTTP headers, processing request data etc. In PHP, it’s taken care of; you focus on your application. Regarding everyone working in unison, Cake/Rails will achieve it better than Ruby/PHP, Ruby/PHP will achieve it better than Lisp. It’s all relative, after all. If my team wrote all its code purely in functions with a file naming pattern and used autoload (spl), we could pull off working in unison just fine. As it happens, we use an OO “MVC” framework we hacked together ourselves; it’s the best we could possibly get, because we built it with our application in mind. Maybe we should have used Ruby for the application; maybe not. But if we did, we certainly wouldn’t have used Rails, and while we’re rolling our own frameworks, PHP suits us better. (If I didn’t have PHP guys on the team, I’d probably have gone for Python/Django.)

    I’m not suggesting PHP is the answer to Twitter’s problems. In fact, Ruby probably is, given they’ve got the expertise in house. But I am saying that Rails isn’t. A generic framework will only take you so far; to be honest, I’m surprised Twitter was still using Rails. The Twitter engineers themselves nailed it on the head – Rails is a CMS platform, it’s not a messaging system platform. The database is irrelevant; it’s the architecture for handling the core business logic. Facebook Chat scaled from 0 to 70 million users instantly because they chose the right tool for the job (in this case, Erlang, apparently) and weren’t constrained by someone else’s design decisions from day 1. I’m not trying to say my language of choice is the answer to everything; PHP certainly isn’t my language of choice in any case (again, Python). The language is also irrelevant: at the end of the day, your framework is the last mile between your application and your stack, and if you build it yourself (as you would in PHP), you avoid a lot of these challenges later on.

    @Daniel0: I mention this in the article – PHP doesn’t enforce very many design decisions at all. It’s the web layer without the framework baggage. I’m not suggesting C is a framework, at least not in the standard sense; but, say, besides SOAP and XML-RPC, when was the last time you used $HTTP_RAW_POST_DATA? You use $_POST, or your framework’s input layer, because it takes care of the POST data parsing. PHP does it, your framework does it a little more. PHP, then, fits nicely into the role of the framework.

  • visudo

    PHP is just a language.

    mod_php is a framework.

  • Johny

    Well nice article i thing something there is right,
    but in case of right usage of the Framework PHP isn´t but anyhow at the moment everything i called a Framework or want´s to be a framework. Before Frameworks i used libarys but now if i need some functions i have to get a new Framework.
    Finally i have Frame Art Works of 5 Frameworks(JavaScript,PHP, AJAX JS, AJAX PHP, PHP Framework) working together at the and.
    But Advantage of PHP is, i can still solve it on the ground level

  • evolve

    I’m a long time reader of sitepoint mainly for its PHP blog because Harry Fuecks is (was?) so insightful about PHP.

    I must say I’m very disappointed with this post. This is not just some blog to duke out which programming language is superior; it is supposed to be a mature medium about web development.

    This post fails because it is not accurate and it is more of a rant then a post about PHP. I’ve noticed that the PHP blog has been very shortcoming lately and I would love more posts, however this kind of post is not the solution.

  • @macro: I agree, but I don’t think it will be a very popular framework. Isn’t “DRY”, the ultimate goal in programming? I don’t think a framework that supports redundant code is a good one to use.

    Also, stop looking at twitter. I’m not saying they are bad programmers, but it’s obvious twitter is a little bit out of their league. So when I hear comments about how they are rewriting the backend in C, etc. it doesn’t really matter to me. I still don’t think thats the proper solution, but again I don’t understand the problem fully.

    Let’s just put it this way. If you rounded up the best 5 programmers in the world. Told them to build twitter with ruby / rails twitter would not have any problems right now. The same goes for PHP, pyhton, java, etc.

  • John Kleijn

    The php standard extension doesn’t impose any structure, hence: it is not a framework.

    Also, you mentioning MediaWiki, WordPress and Drupal aggravates me a little. Sure they are successful, but are they good examples of how to build a PHP application? If you would claim so, I would assume you either never looked at their codebase, or you’re not so hot a developer yourself.

    I’ve personally had it with badly written code and excuses to keep producing it. To me, that is what this post is, an excuse NOT to use a proper framework, and churn out more poorly written, procedural code.

    This reminds of the utterly annoying discussion of Front Controller in PHP. Same big fat bag of BS.

  • phpimpact

    This post is like saying that Ruby is a framework and Django is a scripting language. It doesn’t make any sense.

    You might not need a framework if you use PHP, because it allows you to easily handle files and images, parse XML documents, etc, but that doesn’t make PHP a PHP framework.

    “This post fails because it is not accurate and it is more of a rant then a post about PHP. I’ve noticed that the PHP blog has been very shortcoming lately and I would love more posts, however this kind of post is not the solution.”

    Totally agree.

  • coche

    Hi Akash,
    thanks for your article, I’m agree with you, all you need is PHP itself. I think It worth to mention the Rasmus no-framework because it’s a cool example of how you can follow best practices and also building your own DIY framework. No-framework:

  • coche
  • Anonymous

    Let’s just put it this way. If you rounded up the best 5 programmers in the world. Told them to build twitter with ruby / rails twitter would not have any problems right now. The same goes for PHP, pyhton, java, etc.

    Well, if it takes the 5 best programmers in the world to build twitter with ror then I would agree ror is the problem.


    Drupal is not poorly written code. Failing to understand it, is failing to understand what OOP is really about.

  • Bertrand

    PHP is not a framework, nor a language, it’s a template engine on steroids.

  • markfiend

    I agree: PHP is a framework, and it properly implements MVC as well.

    Model is your database of choice, View is the HTML generated, Controller is the $_POST and $_GET requests to the php code itself.

  • Anonymous Coward

    The arguments in this post are very poorly constructed and immature at best. Definitely not up to sitepoint standards.

    As for Twitter, you misunderstood their developer’s comments. It’s not that RoR is a CMS framework, the problem is they architected the application using a CMS model. One of your colleagues here at Sitepoint has illustrated this point quite well. The performance issues they are dealing with have everything to do with how they designed the app, not with the platform they chose to build it on.

    Twitter could easily run well on RoR, PHP or just about anything else if it was properly designed. The fact is, in this case the developers probably chose RoR because it allowed them to get up and running much more quickly than any other platform out there, but in doing so they made some very poor design decisions. Since they had no way of anticipating the level of success they would achieve, I bet they figured it didn’t matter… or they would figure it out when/if it became an issue.

    Back to the main point – this article doesn’t belong on sitepoint.

  • visudo

    @markfiend: I think you are oversimplifying MVC. I don’t think it’s really possible for a turing-complete language to “implement MVC”. The idea behind “implementing MVC” is that the code controlling each element of the data flow is decoupled and not dependent on other code. So, while it can be argued that the datase is the model, environment variables are controllers, and HTML is the view; it doesn’t mean that any application which uses them “implements MVC”. For example, if your blog app has a column in its database called “blog_post_title”, and your code looks like this:

    $field_name = "blog_post_title";

    if( $act == 'get' ){
        $post = mysql_fetch_assoc( $result );
        echo( "" );
    } elseif( $act == 'post' ){
        $title = $_POST[$field_name];

    … then your Model, View and Controller are heavily intermingled. What if you change the name of the DB column? Then you’ll have to change your CSS file, too. What if you move your controller into a separate file, and can’t use the $field_name variable anymore? Then you’ll need to manually update it as well.

    MVC is very subjective, but be careful that you’re not missing out on the goal, which is modular, decoupled code.

  • visudo

    $field_name = "blog_post_title";

    if( $act == 'get' ){
        $post = mysql_fetch_assoc( $result );
        echo( "<INPUT class='$field_name' name='$field_name' value='".$post[$field_name].">" );
    } elseif( $act == 'post' ){
        $title = $_POST[$field_name];

  • visudo

    Dear SitePoint: I know you’re trying, but please make your comment code filters less “anti-user”. :-)

  • @ markfiend

    > PHP is a framework, and it properly implements MVC as well.<

    Absolute rubbish! PHP is a bare-bones language, not a framework, and as for “properly implements MVC” you are so far off base you are not even in the same solar system! To implement MVC you must have each of the model, view and controller components in its own separate script.

    To say that any old piece of PHP is automatically MVC because the database serves as the model, the web browser serves as the view, and the PHP code serves as the controller is just too stupid for words. The code which generates the HTML output is the view, the code which communicates with the database and handles the business rules is the model, and the code which sits between these two is the controller.

  • Scott

    I agree with you. A lot of these script kiddies out there try to justify frameworks. Frameworks are fine but yes they do not give you 100 % control…

    so keep whining and moaning you script kiddies

  • “Well, if it takes the 5 best programmers in the world to build twitter with ror then I would agree ror is the problem.”

    Or the problem is that you completely missed the point of my statement.

  • onthefence


    I dont think you can call PHP a framework as such. It does handle many things out of the box which other frameworks like Rails dont do as standard. However to call it a framework is incorrect. Its a language pure and simple. There are some very immature people on here larking on about why my framework/language of choice is better than yours. Ultimately everything has its Pros and cons. I use RoR, PHP, .NET and Perl and I like each of them in their own right. To be any good in this game you need to be open minded to new techniques, new languages and new concepts. I quite like the fact the PHP is a ‘loose’ lanaguage and I can churn out high quality effective apps almost immediately. However I also like the structured and strict approach of RoR and .NET and find apps built are stable, fast and quick to debug.

    Ultimately, no scripting language or framework is better than any other. Its all about how you code. Stick to good general programming practices and know each lanaguages weaknesses and strenghts and then apply everything you know to whatever you produce. PHP apps can use as an MVC framework if you code it in the right way!

  • elviejo

    You are right:

    Java language / J2EE Framework
    C# language / .Net Framework
    PHP Sintax language / PHP Extensions Framework

    Just happens that in php the extensions are compiled with the interpreter.
    and they LOOK like part of the language

  • Anonymous

    “Well, if it takes the 5 best programmers in the world to build twitter with ror then I would agree ror is the problem.”

    Or the problem is that you completely missed the point of my statement.

    Or maybe I’m just curious to see if the same guys will manage to make twitter work properly with another language/framework/architecture/design.
    Personally I got no clue what the problem with twitter is but it obviously doesn’t scale. I agree on the fact that if a couple a big applications migrate from RoR to something else, this doesn’t imply that RoR sucks. But what holds true is that RoR was horribly hyped and some people here on sitepoint exactly predicted what’s happening now (long ago). We are in the phase of zealots’ agressiveness and anger; disillusion and acceptance will follow soon or later. And that makes me laugh…can I?

  • dvaknheo

    Or you can use a framework where the programmer never has to write any HTML as it is all done for him with something like XSL transformations.
    there is an replacement for XSL, use static page as template.

    it use SAX mode to parser string . and drop the tagname , explain action by attributes name.

    it is genius but hard to understand for no expressions.
    hope you can read the source commented in English.

  • Anonymous

    PHP is not a framework, as said 50 times. You could call is a mini-framework within a real framework, but thats it

  • markfiend

    Tony Marston:

    Heh, sorry, it would appear that sarcasm doesn’t translate well without flagging it up in some way.

  • Anonymous

    I quote Rasmus Ledorf, creator of PHP:

    “PHP is a templating language. That’s all it is.” – (4/07)-GATECH

    He wonders why people create templating systems within PHP because apparently “” is too long for people. “They want curly brackets.”

  • test


  • shopping cart

    I have also learnt many criticism on PHP but at the end I realise that web is full of the websites in PHP which is easy to development and easy to deploy.

  • Anonymous


  • This article is total BS, PHP is obviously not a framework.

  • aditia

    My opinion, PHP is not a framework, some post above mention about VB and Delphi, yeah this is a framework : Basic / Visual Basic, Pascal / Delphi, like Ruby / Rails
    Framework should provide good coding practice, focus on your application, framework give you simple configuration, name convention, etc. First time i learn PHP i can’t build reusable MVC, I try built my own framework but it make me headache, so I choose open source framework like Cake, CI and it’s make me comfortable with the site structure, file organization, code structure. I don’t think PHP is a framework.

  • mwmitchell

    the term “framework” is so relative! call it what you want. it’s grayscale. where does it start, where does it begin? – does it matter really? php is great for getting things done, but ruby is better! woot!

  • Chris

    I’m a huge PHP fan, but standard PHP does often lend itself to messy code, especially due to the inline HTML style syntax that is used by default. Additionally, so much of web development centers around Create, Read, Update, Delete, so it’s silly to constantly write almost identical queries and form validation functions for different data. Using a framework eliminates the tedium of doing these same types of things over and over. Any good PHP framework will let you build entire sites without ever having to write a query, which by itself is enough to make it worthwhile.

  • jackmk

    This is the silliest article I have ever read.

    You probably don’t understand the concept of framework if you call PHP a framework or try to suggest using a framework is not a good idea. Yes, one framework may be better for a certain job than other, othertimes native procedural PHP would be better (if you need speed). But, that certainly doesn’t mean PHP is a framework.

    The problem with Twitter was not RoR but how they have used it. They could have ended up with same problem by using PHP. I like PHP, don’t use RoR, but we must be fair here. It was not the language the problem but how they implemented it. And their performance problem lied withing DB queries and DB structure not RoR itself.

    I used CodeIgniter, Kohana, tried CakePHP and Symfony. CodeIgniter was best for what I did (I always liked speed). Now I am working on my own framework and CMS system.

    You tried coming up with a cool title but in my opinion you have failed. The links in it ware useful though :)

  • Doug Putnam

    Great article. It raises the hair on the back of many a neck. I love how the language enforcers are punishing you for using their “framework” word without authorization. They’re muddying the discussion with minutiae.

    PHP is the no doubt the unsexy tow truck in this NASCAR race. But, when the others (Ruby, Python, blah, blah) are pushed to the curb for Next Year’s Hot Model, PHP will be hauling their carcasses to the recycling center.

    I teach PHP, Ruby, and Python at CCSF and CSM. My prediction is that 5 years from now I’ll be teaching PHP and something else…Erlang? Haskell? oCaml? Joy? Who knows… But PHP will be on the schedule for sure. I guarantee it.

    For more of the same, read this Sitepoint post about Rasmus’ take on “frameworks”.

  • Klaus

    php is not a framework: it’s a template language. And it’s trivial to deploy. That’s the reason for the success. However, if you come to the point where you need a framework, you may be better with using another language (I prefer Python in this case). But it is hard to argue about that with business people because they think that Python (or other languages) may be to exotic to find a new programmer in case of need.

  • rgz

    @Tony Marston
    > Absolute rubbish! PHP is a bare-bones language,

    What? PHP is the only language I know where the helloworld app is just that: Hello world! This is because not even php programs don’t consider themselves programs but (html) documents. The closest thing in python are triple quoted strings, ruby uses heredocs AFAIK, however both denote strings and return strings. Php tags denote “not-a-string”, they don’t return strings, they suspend dumping to stdout. The core language includes a feature to interpolate variables (the analog to django’s {{foo}} form). is predominantly full of documentation on building websites, that’s not true at all for or, the standard library is full of web related functions, you’d have to compile php yourself to get rid of the headers_sent function for instance. If you command someone to install php, they’ll install apache + mod_php unless you instruct them otherwise. Yes you can ignore or exorcise the web related features and mostly ignore its templating nature and use it for crunching numbers, but that’s really an extra. PHP -as we know it- is a web framework, and there’s nothing wrong with that.

  • Ascenti0n

    I agree to some extent with this article. Frameworks do force you into their way of working, if the devs update, change, delete, create bad code with tonnes of bugs, you have to live with it and adapt.

    – Frameworks are more valuable to larger projects.

    – Build your own framework and you know and control you code, inside and out. A lot of top devs will add to their own framework as they go.

    – Where I disagree: PHP is not a framework, it’s an interpreted language.

    People are way to agressive in some of their responses, they probably need to lay off the caffine, at least until they leave home. ;)

Get the latest in Front-end, once a week, for free.