Laravel : A New PHP Framework
ianlandsman.com
ianlandsman.com
Optionally, one could include a discussion of why one should use PHP, but I realize there is convenience and brevity to be gained from simply assuming you are talking to an audience that is already sold on PHP, rather than Java or Ruby or Python or Clojure.
Why PHP?
Seriously, it does not take the conversation forward.
If php is to advance we should welcome all tools that evolve it.
That and keep in mind there are many projects that don't need something like Symfony or Zend. A lot of projects that is the same thing as using a sledge hammer for a thumbtack. Something like Laravel gives me the tools to get a small project up and running quickly without having to do a lot of the mindless/repetitive tasks we all have to do with new projects.
Lastly, your "solution" that gets your attention is nothing new. It is not web development, it is installing software via a web interface. So you say what does it solve when really you are just asking for another e-commerce and CMS solution. Hmm, that hasn't been done thousands of times before...
http://www.chrisshennan.com/2012/02/16/symfony2-and-sonata-p...
http://sonata-project.org/bundles/
For those who don't know what a Symfony bundle is, you can think of them as an attempt to bring something like Rails Engines to the land of PHP.
What if you want to swap out Request for a mock during unit testing; since you've hard coded the Request class throughout your controllers how would you switch to a RequestMock class? What happens if you were dealing with more than one request (e.g in a HMVC setup).
1). Rolling its own ORM rather than using Doctrine.
2). YATL (yet another templating language). I wish the PHP world would just standardise on Twig.
3). Localisation seems a bit basic at the moment and it's a shame you have to define messages in a PHP array rather than something more portable like YAML.
4). Would have been great if it used Monolog for logging.
On the plus side, I like the clean design and their approach for events looks cool.
2. It's also available. http://bundles.laravel.com/search?q=twig
3. Laravel focus on Event, so you can just set a listener to `laravel.language.loader` event and replace to anything you want it to be. Check http://www.keithloy.me/2012/04/yaml-config-files-in-laravel/
4. Same with Logging, just change https://github.com/laravel/laravel/blob/master/application/c...
2) Why not simply use PHP for templating?
3) Using YAML would be just as bad, if you want to use something use something standard for localization like gettext or XLiff.
2). See: http://twig.sensiolabs.org/ (Why yet another template engine?)
3). Personal preference I guess but I hate gettext. I much prefer the pattern of using labels in your template (e.g. menu.item1) and then looking up that label in the desired language file e.g. messages.en.yml. And I've never had a problem with translators working with YAML files (i.e. the syntax is easy for them to grok)
I'm agree that standardization would be just fine(c), and I like the Twig syntax, but I think the "YATL, we should use Twig" argument is not relevant.
Good to see that.
I feel it would be far more usable and popular if the dev cycle slowed and the framework was allowed to mature and gain some traction.
Taylor has only recently started working full-time on the framework and as a result has been able to "fill out" the framework with community-requested features at a quick pace. It's just a matter of time before it tapers off; there's no point in stagnating the development of such a young and novel framework for what IMO are silly reasons.
class Admin_Controller extends Base_Controller
Seriously, someone thinks this is OK?I am re-building a project in Laravel right now that I started with Slim, using a couple of Symfony components and own code and it's a bit of a turn-off for me that I ended up with quite mixed naming conventions now.
With so many PSR-0 compliant PHP libraries and Composer on the rise, I just think it's the way to go. This doesn't stop me from trying Laravel though and so far this is the only thing that kind of bugs me. But don't get me wrong, basically I really like it so far.
The omission of namepaces in the case of controllers was a calculated decision. PHP's implementation of namespaces is... inadequate, and would have required annoying workarounds, so prefixing controllers was the better evil.
<code>class Admin_Controller extends Controller</code>
With that said I used to try every "small but efficient" framework when I was a web developper and I would surely have tried this one with enthusiasm.
For simple cases, I often fall into a (M/C)+(VL/V) pattern: model and controller fused into one layer, view-logic and view into another. If database logic is sufficient complex or used in multiple places, break it out into its own layer, same for view logic. No pattern can or should be a universal panacea for every use case.
All that said, I'm really liking Laravel's approach. It's high time that PHP frameworks started getting wise to closures.
The thing about this that it lends itself well to HTTP because HTTP is a request-based system.
Once you start breaking down the barriers between requests you get all kinds of horrendous issues with race conditions and memory sharing and pain. Sessions just about get by this because they are per-user and people don't oft do huge amounts of things concurrently.
PHP is also designed on a per-request basis.
RoR has spoilt me. Anything that is similar to RoR is highly attracted to me.
In terms of main differences, it's PHP rather than Ruby which means it's verbose rather than terse and it's less automagical than Sinatra / DataMapper.
If you need to use PHP for a project, then it's a great choice, but if you don't then you're better off with Sinatra (or Express and Node depending on what you're wanting to do).
which does nothing more than
static function factory($model_name) { return new $model_name . '_Model'; }
I think written documentation is just fine.
Harden up and evaluate software correctly.
I didn't realize the whole thing was a joke.
Or not.
You didn't look hard enough - see Lithium
I also like the DB table creation code. ActiveRecord-type model delcarations are fine, but I'm interested in exploring Mongoose-type ORM, since I suspect it is more flexible in the long run.
If you know PHP/Ruby/Python/etc, you should be able to pickup a new framework within a day or two.