James Andrews

PHP Framework.

by jandrews on Mar.25, 2009, under PHP Development

With one of my php endeavors I decided to stay away from using one of the many PHP frameworks. When we started Givvy we decided to use the Symfony 1.0 framework as our base. This was good for a lot of reasons. Primarily it allowed us to push ahead relatively quickly and made a website that should have taken 4-5 developers 12 months to make and allowed 2 developers to make in the same time span. You ask “Why not just continue using symfony?”. Well first off, I am not 100% happy with the direction the framework is going in. Not that it’s the wrong way as there is no right or wrong way, but I just don’t care for it. Second is I feel that it’s memory foot print per page load is excessive. Try doing a print_r($this) inside a module action and you’ll see what I mean. Time after time, the same objects seem to be in memory 5 or 6 times. Then if you want to get at some of those objects there is no way for asking $this for them, you actually have to instantiate another instance of the object carrying the object and ask for it, which seems a bad when you already have it in memory. Lastly KISS, Symfony creates holders for data sent via form whether it’s a GET or a POST the idea is to ask for it using $this->getRequestParameter(‘paramName’);, Why? What’s the point. If you have $_GET and $_POST you already have access to the data, what is the purpose of passing it through an arbitrary function? Then just looking through the source code it seems like you are loading 3-5 different objects just to create the parameter holder for the action/component. It doesn’t seem like a good use code, and seems rather unnecessary.

That said, Symfony has a lot of ideas that I do like. I am a huge fan of MVC and looking at the different frameworks I like Symfony’s method the most. I also like how they use some external libraries to handle the model aspect. Here they are KISS-ing. Propel came default with 1.0, and the 1.0 has a plugin for using doctrine. I like their basic idea for routing, but one of the problems that wasn’t addressed until either 1.2 (or maybe it’s coming in 1.3) is making other applications within the project aware of each other’s routes. Therefore, I will be using some of the ideas of symfony for structuring my framework. I want something.

The goals of my frame work are as follows:

  • Small size: I’d like to see the core framework at under 150K Currently it’s at 52K
  • MVC capable. Currently the MC aspect are in place. I want to allow for use of any model library (Propel/Doctrine etc) which should be fairly easy to accomplish. I will not be shipping a model library with the framework, but it is possible I may add script for working with the one I decide to use.
  • Helpers and modules: I like Symfony helpers, it’s a great idea, so I am going to do something similar, but not the same as 1.0, modules will be completely different, but serve the same purpose as Symfony plugins. Neither will be included in the framework itself, but the base abstract class for creating them will be.
  • Caching ability. I’ve already got a class for caching array data. Now for one for content data. I also want the cacher to work with Memcache (currently it works off Cache_Lite) I’ll allow the site creator to chose which to use, but at least one of them has to be used.

I’ve got the repository set up, and once I get a usable version up I will post so people can use it and tell me I am right or wrong about why I did it. ;-)

:, ,

Leave a Reply

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 766 bad guys.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...