
Laravel : A New PHP Framework - rshetty
http://www.ianlandsman.com/2012/02/22/laravel
======
markessien
There needs to be a quick overview of the syntax or how it works. I don't want
to read pages of documentation just to figure out how it looks like.

~~~
kbanman
<http://getlaravel.com>

------
newbie12
I respect the work, but the samples look a lot like Symfony2, which has a huge
community behind it. Sf2 has a learning curve but I'm not sure what problem
Laravel solves that Sf2 (or its simplified kid brother Silex) doesn't already
solve.

~~~
lkrubner
I agree. If someone wants to launch a new PHP framework in 2012, they should
at least talk about some of the leading PHP frameworks (Symfony, CodeIgniter,
CakePHP, etc) and say why those frameworks are not adequate.

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.

~~~
rmATinnovafy
Why not PHP?

~~~
lkrubner
Imagine the conversation we would have if I hit the reply button and wrote:

Why PHP?

Seriously, it does not take the conversation forward.

~~~
rmATinnovafy
I know its not perfect, and has some little loved features. But for me a
language is a tool. And tools are meant for specific jobs. Like I wouldn't use
a phillips head screwdriver where a set of pliers is needed.

If php is to advance we should welcome all tools that evolve it.

~~~
antihero
Or ditch it already and write Python/Ruby.

~~~
rmATinnovafy
Why don't we ditch Python/Ruby and just go with CLISP?

~~~
antihero
Because Python/Ruby are decent languages, CLISP isn't objectively better, it's
just different.

------
jamesmoss
Something I find really strange/frustrating with a few recent frameworks
(Laravel included) is their overuse of static methods. You have these
singletons floating through the framework which maintain state (Request,
Session, Logging etc) but you can only ever access them statically. Seems like
bad practise to me.

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).

------
corford
It looks interesting enough but a few things put me off:

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.

~~~
crynobone
1\. You can use Doctrine bundle <http://bundles.laravel.com/bundle/doctrine>

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...](https://github.com/laravel/laravel/blob/master/application/config/error.php#L64-67)

~~~
corford
Thanks crynobone. Looks like I was too hasty in my criticism.

------
kumarshantanu
It appears more functional in style: <http://laravel.com/docs/routing#the-
basics>

Good to see that.

------
tar
What I would like to know is how exactly is this different from the hundreds
of open source PHP frameworks available out there?

~~~
kbanman
It takes full advantage of recent advancements in PHP to facilitate more
functional programming.

------
stephenr
Why are so many PHP 5.3 frameworks like this ignoring namespaces.

    
    
        class Admin_Controller extends Base_Controller
    

Seriously, someone thinks this is OK?

~~~
kbanman
Laravel makes extensive use of namespaces.

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.

~~~
ihsw
How is PHP's namespace implementation inadequate? Use-as statements are the
staple of every PHP library that uses namespaces, and this seems like a half-
measure to placate less-experienced programmers.

------
bobsy
Its a good framework but the development cycle is far to fast. Every few
months there is a new full iteration where core functionality is added and
development practices change.

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.

~~~
kbanman
It will slow down shortly, I expect.

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.

------
daylerees
Hey all, glad you find getlaravel.com useful. You could also checkout my blog
which has 22+ Laravel tutorials including tips and tricks :
<http://daylerees.com> . There is also an ebook available, linked from the
site. Thanks!

------
johnchristopher
I don't totally agree with the author: coming fresh to php 5.3 without prior
contact with the elephant isn't going to protect anyone from php's inherent
inconsistencies or legacy way-of-doing-things for very long. I am specifically
thinking about the different naming conventions for functions (sometimes
underscore, sometimes not ). Of course my remark isn't about Laravel itself.

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.

------
popasmurf
You should check out <http://getlaravel.com/> for some basic examples. I've
been using Laravel for a few weeks now and I love it! The simplicity is next
to none and it certainly has sped up my dev time. I'd recommend trying it for
a week and see how you get on, I think you'll fall for it too.

~~~
skrebbel
That feels very lovely indeed. I really like the URL reverse routing, have
been missing it from all the frameworks I tried.

------
balac
It looks pretty nice! How can I be sure this will continue to be maintained
far into the future though? At least with Zend / Symfony I know they are not
going anywhere for the foreseeable future.

------
maxpert
Definately one of the most clean coding frameworks I've seen.

------
digitalman
It isn't new, but it's in the buzz. Let's face it, stateless MVC for the web
is a local maximum. We can do much better, but not if we stick with this MVC
crap.

~~~
pestaa
What do you suggest as a replacement of MVC?

~~~
lukifer
MVC seems an odd paradigm for the non-realtime web, when you have to
instantiate every object on each request, and data update events are the
exception, rather than the rule.

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.

~~~
antihero
> when you have to instantiate every object on each request,

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.

------
pknerd
So is it like making something similar to RoR? If yes then I am interested.

RoR has spoilt me. Anything that is similar to RoR is highly attracted to me.

~~~
thomseddon
CakePHP (<http://book.cakephp.org/2.0/en/index.html>) was initially built on
ROR concepts. It follows a brilliant MVC pattern and gets you up and running
with 'bake' (think 'rails generate') so if you know RoR and PHP, then you will
feel very at home with Cake.

~~~
arthurschreiber
Yes, but their Model layer, in comparison with what ActiveRecord provides you
with, is really not that great. One of the main aspects that I really didn't
like was that the Model finder methods don't give you object instances back,
but instead you get php arrays with the fetched data from the database.

~~~
thomseddon
Personally, I have never found this in any way restrictive?

------
optymizer
Laravel does not cache routes defined in routes.php and especially those
loaded from disk with Controller:detect(). What a pitty.

------
buremba
It's very similar to Kohana 3.

~~~
ttsaia
Not really. Kohana uses static methods to create objects extensively. Laravel
looks largely procedural to me with static methods updating static classes.

~~~
jtreminio
Kohana uses things like, $foo = Model::factory('Bar');

which does nothing more than

static function factory($model_name) { return new $model_name . '_Model'; }

~~~
ttsaia
Exactly, because of how its autoloader/class finder works.

------
EugeneOZ
globals, static methods... bad code again.

------
rorrr
It needs a 2-minute video to "sell" it to me. There are literally hundreds of
PHP frameworks. Your list of "highlights" didn't make me want to try it.

~~~
mahmud
How about a webinar, or a conference call?

I think written documentation is _just_ fine.

~~~
MrMatters
Written documentation _is_ fine, but a quick video would help. That's not
unreasonable for something like this, you could have replied more nicely.
Instead of like a _terrorist_.

~~~
mahmud
You have been conditioned by far too much hype. You need to evaluate your
software, not be _sold_ on it.

~~~
rorrr
I need a reason to evaluate your software. There are hundreds of frameworks.
If I start evaluating every single one of them, I will spend the rest of my
life doing just that.

~~~
mahmud
Your job is to select the best tool for the task, not the best marketed tool.

Harden up and evaluate software _correctly_.

~~~
rorrr
whoosh

~~~
mahmud
Makes complete sense, now that you put it that way.

I didn't realize the whole thing was a joke.

------
wseymour
"I was looking for a framework that supported PHP 5.3"

You didn't look hard enough - see Lithium

<http://lithify.me>

~~~
elliotanderson
Or Symfony2/Silex (based on Symfony, but designed more like Sinatra)

<http://symfony.com/>

<http://silex.sensiolabs.org/>

~~~
conradfr
and soon Zend Framework 2.

~~~
Pawka
...which even does not have RC yet...

------
ellie42
Validations in routes, you're doing it right
[https://github.com/laravel/pastes/blob/master/application/ro...](https://github.com/laravel/pastes/blob/master/application/routes.php#L52-66)

~~~
tabbyjabby
I think the routing in that example is meant to be Sinatra-style routing for
lightweight applications.

~~~
fruchtose
I really like this approach. It's one of the reasons I like Express in
node.js. I am by no means a fan of PHP after using it on several projects, but
if I were forced at gunpoint I would look into Laravel.

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.

------
fatjokes
Please let PHP die.

~~~
nestlequ1k
This is how PHP dies. You end up with 100 frameworks, and it's impossible to
hire anyone who has experience with the framework you are using.

~~~
envex
Any developer worth his weight should be able to adapt to any framework
written in the language he knows.

If you know PHP/Ruby/Python/etc, you should be able to pickup a new framework
within a day or two.

