BT

Fuel PHP: An MVC Framework

by Jonathan Allen on Sep 01, 2011 |

The Model-View-Controller pattern is pretty much dominating professional, customer facing website design these days. While single-file scripts are still suitable for personal sites and form builder technologies such as ASP.NET Web Forms offer fast development times, MVC seems to strike the right balance who need to work in large teams and yet still have fine grained control over the generated HTML. The Fuel framework for PHP intends to capitalize on the work done by earlier MVC frameworks such as CodeIgniter, Zend Framework, Symphony and Ruby on Rails.

Like most MVC frameworks, the file structure has meaning. There are specific folders for assets, views, controllers, and models. In addition there are places to put general application code and framework packages. While routes can be configured, by default a URL is mapped to the name of the controller class and action method.

A common objection to MVC style frameworks is the additional amount of code necessary to do anything. With single-file scripts, one handles everything from request processing to HTML generation in a simple, linear fashion. By contract, MVC requires at least a controller and view, and in most cases a model is needed to transmit data from one to the other. Scaffolding, a form of code generation, is thus quite popular. In Fuel PHP an application called “oil” is used for this purpose.

The Philip Sturgeon’s walk-through on Nettuts+ also covers form generation and data validation. Again, these are standard techniques that are quite familiar to MVC developers on other platforms. Fuel has a basic database abstraction layer out of the box and an optional ORM package for those who prefer that form of data access. The ORM is based primarily on ActiveRecord, but was also influenced by other ORMs.

Fuel is released under the MIT license and is currently in its first release candidate with at least one more planned.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

ORM by Kev Burns

PHP does not need another ORM. It would be nice if framework developers would top proliferating subpar ORMs with their frameworks and instead build upon existing ORMs (such as php-activerecord, propel or Doctrine).

Re: ORM by Kev Burns

s/top proliferating/stop proliferating/

Re: ORM by Richard Clayton

And does PHP need another MVC?

Re: ORM by LK Gahlot

Precisely! There are so many already. But I guess good ones survive. I covered this topic in one of my blog post sometime back. bit.ly/puwV84

Re: ORM by Jonathan Allen

How many does it have now? (We don't have a PHP expert yet and I'm still learning the lay of the land.)

Re: ORM by Richard Clayton

23 on the wikipedia page, not counting this new one: PHP MVC Frameworks - Wikipedia. From what I've read, Symphony seems to be very popular, but I gave up on PHP a long time ago.

Re: ORM by Phil Sturgeon

The slogan of this website is "Tracking change and innovation in the enterprise software development community" but you seem to think innovation means "just use whatever is out there even if you don't like it or agree with it".

The developers of this framework (myself included) all have a heavy background using other frameworks such as Rails, CodeIgniter, Kohana, etc and we have put together Fuel as something we personally love to use and shared it. The reason the original poster found it is because so many other people liked it we've got a huge amount of hype around us.

This is not just another script kiddie releasing some random POS framework, but the product of 4 serious developers and a team of over 50 contributors from the community, putting things together over a year.

Take a look before you say "yet another framework".

Re: ORM by Phil Sturgeon

How many cars are there in production? Why are Ford still inventing new ones? Oh god are Chevy still making cars? And Volvo? Where will they all go?! ;)

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

8 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT