Disclaimer: I don't want to start any flame war so there will not be no name of any framework mentioned.

I've been using quite many from the existing PHP frameworks and my experience in each case was similar: everything is nice a the beginning but in the moment you require something non standard you get into lot of problems to fix otherwise simple issues. In case of frameworks following the MVC design pattern there are some issues with the implementation of each layer for example there is a lot of codding used for model and data access with using ORM and presentation is not much more than pure phtml. Some frameworks use their own wrappers for existing PHP functionality and in some cases severely limiting original functionality. Depending on framework you can have additional problems like lack of documentation, slow or non existent development cycle and last but not least speed.

While ago I made my own framework which while doing it's job and being used for few different applications after couple of years more of experience with PHP doesn't seem to be perfect piece of codding. I could write my own framework and use additional experience I've gathered during these years to make it better on the other hand I'm aware that there is quite many better programmers working on creating/upgrading existing frameworks.

So does it make at all nay sense to write my own PHP framework if there is so many possibilities to choose from?

  • 2
    Sorry, but this is not a constructive question. There are only three reasons why you should write your own framework. 1. You are learning, 2. You are not allowed to use them or 3. The existing ones don't have the functionality you need. Though I would seriously consider that what you want to do isn't really useful if that's the case. – ChrisF Nov 14 '12 at 21:40
  • 1
    @ChrisF I think that #3 is not as simple as you describe it as it is not only question whether functionality is there or not. In case of every framework if I wasn't using it for building some standard websites I got into problems which I was able to solve but it was always additional task caused by the fact that I was using particular framework. In some cases there was no other solution except hacking into core framework code. – onlineapplab.com Nov 14 '12 at 21:54
  • 1
    Maybe have a look at frameworks that are not based on PHP. – thorsten müller Nov 15 '12 at 8:09

Absolutely, roll your own if you want. Don't listen to naysayers. The reason that there are so many frameworks to choose from in the first place is because people ignored the tired 'dont reinvent the wheel' mantra and tried to make something they thought was better.

So, re-invent the wheel if you feel the urge. You'll learn a lot. And who knows, maybe a year from now your framework will be the one that everyone is supposed to be using instead of making their own.

  • Current automotive wheels have inflatable rubber tires that can be punctured, wear down over time, and if the inflation is lost, the rim will likely be bent & made useless, & it takes a team of friends to change the tire lol... So yeah. Wheels could be better. (though I'm biased as I've been working on my own framework for over a year) – Reed Apr 14 '20 at 18:30
  • I agree with building your own framework if you want to. It's a great learning experience, and may end up with fantastic software to use & share with others. But it's probably a really bad business decision to wait for your custom framework to be completed before moving forward with... whatever your core business is. AKA If you need to go to the grocery store this week, don't wait a year for your innovative new wheels to be designed & built. – Reed Apr 14 '20 at 18:45

I don't think it make sense to create your own framework completely from scratch with the wealth of libraries that exist out there. I have actually created (or glued) my own framework together with using Silex as a base, added some functionality to be able to use yaml for configuration, be able to use class as the controllers easily, ability to create the standard REST APIs with like 6 lines of controller code, and then add in a completely custom DAL/Active Record system (because I don't like any of the existing ones out there). I also use Monolog for logging.

I think writing certain components of your framework can be warranted but not the entire thing, make use for those good open source general purpose libraries (a lot of the Symfony2 components can be used by themselves and Silex is just a collections of the core ones).

  • 2
    You say it doesn't make sense but yet you created your own framework ( more or less ) and ignore your own advice. What does that say about your advice? – Ramhound Nov 15 '12 at 12:44
  • I said your should write your on framework from SCRATCH which I did not. I use a lot of other 3rd party libraries that provide functionality that I like and then implemented only a DAL/ORM solution from scratch (there is a lot more to a PHP framework than just a DAL/ORM). – ryanzec Nov 15 '12 at 16:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.