Micro frameworks

I’m probably getting the cart way out ahead of the horse here, given my current level of php-fu :wink: but I am curious… over in Python-land I regularly see mention of various ‘micro’ frameworks such as flask, bottle, web.py, etc. on up to nearly anything ‘lighter’ than Django. Here, in the PHP forum… I don’t see much mention of ‘micro’ frameworks, at least not judging by the names that get returned when I Google for ‘PHP micro frameworks’… Any thoughts on what would constitute a ‘micro’ framework in PHP, and when they might be appropriate - or not?

TIA,

Monte

I’m working on what might be considered a ‘micro’ framework, but it’s overdue, 6 months behind schedule, and probably going to get it’s teeth knocked out for PHP 5.4 inclusion. It’s also focused not so much on being ‘small’ as being a ‘teaching’ framework - though those two goals are congruent.

I think you’re right that micro frameworks haven’t permeated into the PHP community very much. I don’t personally see their point, for a couple reasons:

First, the major PHP frameworks are autoloaded. So no matter how many classes or files are included in a framework, only the parts you actually use are loaded.

And second, if you’re building a large-scale app, then you’ll want all the features and structure that a framework provides. And if you’re building a small-scale app, then a few extra milliseconds won’t matter anyway.

I am writing a micro-framework to implement frontcontroller, command pattern, mvc etc. I am a bit stuck on using activerecord pattern or not. I got some bad performance on my latest implementation of activerecord.

No idea why there are no popular micro-frameworks for php. It might be because a lot of php developers choke when you mention mvc, command pattern, oberserver pattern etc in one sentence. Or they respond: I use Zend Framework.

I hope my framework will become popular once it’s finished :smiley:

There are a number of ‘micro-frameworks’ inspired by Sinatra. Like [URL=“http://www.slimframework.com/”]Slim and [URL=“http://flightphp.com/”]Flight.

Micro-frameworks tend to be best at solving application routing. They are useful for creating RESTful API services for example.

Silex is the new kid on the block. http://silex.sensiolabs.org/

require_once __DIR__.'/silex.phar'; 

$app = new Silex\\Application(); 

$app->get('/hello/{name}', function($name) use($app) { 
    return 'Hello '.$app->escape($name); 
}); 

$app->run(); 

Silex has the distinction of sharing some of the same components as the full featured Symfony2 framework thus offering a reasonable upgrade path.

Okay… for the un-enlightened (me) could you give some examples of the above? I’ve seen the buzz words tossed around in forums but I’m not really sure what they mean…

TIA,

Monte