Iniciar sesión Translate Vladstudio Español

Blog 

Laravel - a beautiful PHP framework that does not make me feel stupid

{15 Mayo 2012}

I may have solid artistic skills, and I also enjoy web development (most of the time), but the sad truth is that I am an awful programmer. I came to web development “the wrong way”, inserting <?php ?> blocks into my HTML code. As any awful developer, I had no idea I was doing something wrong :-)

Until now, that I urgently needed to develop (or rather, re-make from scratch) a not-so-simple online translations system for many of my projects (including Vladstudio.com website and Windy Press books). I started with my usual stuff - one PHP page for one action (like user-add-block.php), but very quickly got buried under my own spaghetti code.

I got depressed (I do so sometimes!), and despite having very stressed deadlines all around, decided to calm down and see how I can improve. I spent weekend learning Python, and it is definitely more beautiful language than PHP, but the time was not perfect for such serious switch, so I started searching for PHP framework to help me do more in less time, and write better code.

Another several days passed, I browsed hundreds of discussions, discovered and carefully reviewed dozens of frameworks. Unfortunately, none of them resonated with me immediately. In case you’re curious, here is the incomplete list of candidates (scroll down if you’re not):


logos

My requirements:

CodeIgniter

Kohana

Dingo

Symfony

Silex

Nette

Simple PHP framework

CakePHP

Yii

Zend

Fat Free

Fuel


… and this is the incomplete list! In despair, I decided to try again and start from scratch, reinvent my own wheel again, just try and keep my code more organized.

Another couple of days, and another failure was rising on the horizon. Then suddenly, in this Habrahabr post, a commenter mentioned a framework I never heard of - Laravel by Taylor Otwell.

sponge bob

As I was reading through the documentation, the harmony and piece of mind returned to me. Every aspect of the framework is done the way I would do if I was awesome programmer :-)

Ian Landsman (the boss) explains why Laravel is so good:

I’ve come to since find out that Taylor wasn’t really a PHP guy, working primarily in .NET before deciding to pickup PHP a few years back. I think a great deal of why Laravel is so unique is due to that fact. He learned PHP at 5.3+. Most people you see working on PHP frameworks have been around since 4 and before. … Not just the simple thing of not supporting PHP < 5.3, but not knowing PHP < 5.3 means he was unencumbered by all that mental debt :)

Here is what I like about Laravel:

screenshot

Instead of jumping into the docs, I recommend that you start with this excellent set of tutorials by Dayle Rees (also available as pdf/epub book). Some quotes:

… Head over to your application/config/database.php config file, if you have ever installed a PHP application you will be familiar with this kind of file, you have your database access credentials to hand don’t you? If not go dig them out right now! … Are you back yet?

… Woop, if we take a look at our database the users table has been created successfully. Wait, we made a mistake! (we didn’t, but I like drama and I need an excuse to use rollback)

… DB::table(‘shoes’)->take(10)->get(); Now I want 10 shoes? I should be more worried.. But it’s clear, limiting is very simple!

… We don’t need the first 5 pairs of shoes do we? They are leather shoes, I like to wear skate shoes, very wide feet you see.. Let’s just skip them. DB::table(‘shoes’)->skip(5)->get();

… Relationships are beautiful. No I haven’t gone all soppy. I mean relationships between tables, in Eloquent they are beautiful.

… You see artisan takes the current date, and adds the time in His format to create the file name. The reason for this is that dates are very important to migrations (and single people),…


Now, I have zero experience working with Laravel, and in a month I may update this article with how bad it turned out to work with. But I don’t think it will happen. I really look forward to digging it deeper and doing amazing things with it!

← New abcNotes for iPad with Vladstudio wallpapers for Retina display PSD source files are back! →

Comentarios {71}

Edwin 15 Mayo 2012
I agree with your framework comparison. I'm also in the midst of switching my website which is currently basing on CI to Laravel. Things are getting better and I love this new framework more and more everyday.

Carlos 15 Mayo 2012
The same story here. I was so frustrated with the endless configuration for other frameworks. Even tried building my own a few times, and while it was more or less working, Laravel came to my life. I found the perfect one. :D

Geoff 15 Mayo 2012
I think you're right that Laravel will make you a better programmer: I've got a bit more background than you, but I'm learning a lot from Taylor's approach. I went through a similar process to you: Symfony2 is too bloated and complex for small business use, I felt; Zend2 is unfinished and equally huge, Yii is powerful but rather strange and some of its best features are quite inflexible, Nette is tempting but not as elegant as Laravel and has few English speaking users, CodeIgniter is out of date, Kohana felt a bit strange and the docs are poor, and the Roadmap for Fuel makes it clear that they think they've got a key things wrong in the current release, as they are planning some radical changes. Laravel seems to offer a good deal of power and flexibility, but with elegance and simplicity. The more I use it, the more I appreciate it's strengths. A very happy user...

Abdullah Al Mamun 21 Mayo 2012
Kohana is the most elegant one

Christopher 12 Junio 2012
Nice post, just came across your site again! So just to contribute, I found myself in the exact same situation a while back. I found the perfect framework, great community and loads of extensions. The nice thing is it really is stripped down and you basically build what you need it for, but the backend is done! The templating is pure beauty based on XSLT, so you can't write ugly markup! check it out: http://www.symphony-cms.com (not to confuse with symfony)

Rich Lovelock 14 Julio 2012
Why did you have mixed feelings about FuelPHP? What was inflexible in Yii? I've narrowed it down to Yii vs FuelPHP vs Laravel

SoS 22 Julio 2012
Laravel took the concepts from django.

Samuel Wahome 24 Julio 2012
I love codeigniter so much and well. It is still much alive so dont be fooled. I can do a million things in codeigniter that lareverans can't do though I dont go saying bad things or giving my bad opinions about other frameworks as there are people who love using them. I for instance love Ci but I get to also combine it with Zend (Haha .. its quite normal) so you get the simplicity of CI and the robustness of Zend. Anyway I have checked out Laravel it 'looks' promising but it will take much effort to translate the same CI project to it. I found its docs quite hard to go through thanks for the link to Dayle's Tutorials they help a lot.

Zuko 19 Agosto 2012
@Vlad ... any start up guide for laravel (php rookie)?

rooco 1 Septiembre 2012
Im using Yii now,, i find it is fun to work with Yii,,,,and i never look at another framework again

PHP Coder 1 Septiembre 2012
If you spend some time on Yii learning - it can beat all the other frameworks.

Dorin Moise 20 Diciembre 2012
CakePHP is nice and I am using it, but I am not a designer.

L 22 Enero 2013
Laravel - there are some docs (very basic, lack a lot on details, not as good as CodeIgniter), but if you are doing something more complicated that BLOG you will hear: "read the source code - API". Sweet!

Shawn Ang 21 Mayo 2013
Generally, CakePHP lead me to understand more about MVC. However, I chose Laravel over CakePHP just because of the performance issues.

Luiz 20 Junio 2013
I agree with you. I spent some time researching frameworks, but so far the laravel is the most elegant framework I found.

Tux 1 Julio 2013
From CI, I moved to laravel, combined with angular... It's very interesting especially when all things work like they know each other for a long time already.

Marcelo 10 Julio 2013
Unfortunately it does not work in php

Marcelo 10 Julio 2013
Unfortunately it does not work in php < 5.3 *

Farhad Arjmand 24 Agosto 2013
I love Yii so much and well !

se-nerd 12 Septiembre 2013
I am not a corporation and symfony2 works wonders. I also have had experience with nearly every framework you list.

izofer 10 Octubre 2013
I love LARAVEL...it's my life :D :D :D

Antoine 2 Diciembre 2013
Hey, nice article. Just to let you Dayle Rees changed his URLs, so your link returns a 404. Thanks

John Doe 6 Diciembre 2013
I feel terrible for you and I hope you find a line of work more suited to you. You admit that you're a terrible programmer and that frameworks are your salvation? They're no salvation at all. You're not really programming. You're using what used to be called a code-generating tool. You're poking at machine-generated code and pretending to be a programmer. You're essentially just generating someone else's code - which will soon be outdated, difficult to upgrade (if it's even still used or supported), and even more incompatible than it is already (since no two frameworks are compatible). That auto-generated code that you worship today will be laughed at tomorrow. You're impressed by it now because it looks complex - not because it's well-suited for what you need it to do. If half of what it did changed tomorrow, you wouldn't know the difference. The MVC paradigm is so critically important for what you're working on? I doubt it. My guess is that the framework you're using now is a convoluted, bloated patchwork of trendy and obtuse functionality, 90% of which isn't needed or appropriate for what you're building.

Chris 12 Febrero
Have a look at Phalcon PHP Framework !

EliuX (eliecerhdz@gmail.com) 13 Febrero
I love CodeIgniter its so far the best framework for beginners. I´ve studied Yii and despite i have never used it in a project it is perfect, it allows event generation of code asisted by web and it works out of the box, despite Laravel which has encouraged me and many others to work with it but it requires downloads with composer, and behind a proxy like I am and other disabilities it maybe a pain in the ass. The problem is that i love pyrocms which is a framework based in CodeIgniter, but its leaders decided to move on with laravel, which uses very well PHP 5 and it´s based in Symphony that has a very pretty architecture that relies in other proved php projects, which is the best. So the question remains... ¿Yii or Laravel?

Gvanto 25 Marzo
Hi, While Laravel sounds great, Yii is, for PHP developers, the best option. I built http://twoggle.com using it and it was nothing but pure pleasure.

satu 28 Marzo
this is nice 8989

Slim guy 7 Abril
The most easier I think is slim framework and the most fast also

Jesse 10 Abril
I think PhalconPHP needs to be in here.

ru joking 2 Mayo
Howdy! Two hours before, I found CI. It looked nice, I never worked with a php-framework, I am more in design, too. So I started and, well, it was a nice try. I just did the news-tut and after that I wanted to change the URL (-index.php). The docs didnt fit, so I ran google, which brought me to http://www.web-and-development.com . And on this site, I found some other CI-posts. The next post I read mentioned that somebody didnt feel stupid with Laravel. So I came up to your Studio here, Vlad. Well, what should i say... After two hours loving CI now its time for some changes in my hard programmers life. I will start working with laravel after sending you my comment. Its not because "it looks good", no. I'am not such a crazy guy like you! I would never go such an insecure way! ;D ...I thought. But in fact, its because of Dayle Rees quote: "The reason for this is that dates are very important to migrations (and single people),..." And single people!!!! :D:D:D Dayle got that point! :D Lets see at Laravel. Howdy & best regards from Saxony!

pelayo 10 Agosto
gracias

Vlad Gerasimov 15 Mayo 2012
Edwin - glad you agreed :-) unlike you, I am new to the world of frameworks!

Nickolay 15 Mayo 2012
What's wrong with Cakephp? :)

Maikel 15 Mayo 2012
I moved to Laravel a few months ago and haven't looked back :)

Proger_XP 15 Mayo 2012
Nice article, I think you've got it right. I didn't know Taylor wasn't a PHP guru... although it doesn't really matter - as long as one knows the programming technique well he can write awesome apps in any language he learns the syntax for.

Slimmer 16 Mayo 2012
Codeigniter = shit Cakephp = shit Kohana = bullshit Anybody knows from slimframework? http://www.slimframework.com/ Read, learn, use

BS-Harou 16 Mayo 2012
I'm glad I'm from Czech rep. so I can use Nette :)

blacksonic 16 Mayo 2012
it seems to me, that u get tired at the end of frameworks...u wrote just feeling at the end, and Zend has pros, and Yii framework is very easy to use

rootkowski 16 Mayo 2012
Great job and a great post! I'm definitely gonna have a closer look at Laravel. Thanks for the advice!

Dayle Rees 13 Junio 2012
Thanks for the mention + link! Also great site design, love the dual column comments, and 9000 internets to you sir for making it responsive! Dayle.

Michael 9 Julio 2012
Interesting. Why do you have mixed feelings about FatFree. I've really been enjoying it. The only downside so far is that it doesn't have bundles, so you have to make things like user authentication systems yourself. Otherwise it's been a great framework. Clean and fast.

Sunny 19 Julio 2012
I'd take a serious look at Laravel but my host is still on 5.2.x, so Laravel is worthless to me. From what little I've played with Yii, I really enjoyed it; but I haven't used it for a real project yet.

pollo 3 Agosto 2012
I ´m coming from CI, trying to get the next step on Frameworks. Looking some breeze about Laravel and FuelPHP my near options.

Dan 3 Agosto 2012
What about CakePHP? That seems like a pretty important framework to not post any information about. Is it because you haven't delved into CakePHP development? I'm pretty interested in knowing how CakePHP and Laravel compare to one another.

petrivoges 17 Agosto 2012
If you cant get to grips with Yii then there is some fundamental programming basics missing and I would invest some time in those before running after a framework to solve your problems. Wordpress will solve most of your problems, has a massive community and is maintained by pro's.

Ako Kaman 3 Septiembre 2012
I have played with several frameworks, including CodeIgniter, Symfony, Django, and Rails. I must admit, Laravel is the best framework among the PHP ones (in my eyes)!!! And one more thing, your website is so beautiful. Good job man!

Prabin Giri 9 Abril 2013
I liked this line "I judge things by their look." , This is exactly what I do , being a programmer though!!

Dorin GRIGORE 1 Mayo 2013
I tried CakePHP and Yii frameworks. Yii seems promising. Now that i saw your post i want to test Laravel.

Ioana 13 Junio 2013
I am researching various PHP frameworks for my collage degree project and your article was so simple and straight forward compared with others. The way you expressed yourself brought a smile on my face,the smile I get everytime I read from Dayle Rees 's documentation. Thank you for the short +/- on all those frameworks!

Kevin 5 Julio 2013
So after a year do you still feel the same?

Vlad Gerasimov 7 Julio 2013
Kevin - hard to say! Since writing this post, I did no web development, so I did not actually use Laravel. So I cannot say if my initial impression was right or wrong.

Webostin 31 Julio 2013
What about CakePHP? You did not write anything about it. I am going to switch from CakePHP to Laravel but I am worried about popularity of Laravel and support. What about baking in console in cakePHP, it's awsome!

Farhad Arjmand 13 Septiembre 2013
Yii :) everyone likes it

PHP developer 16 Noviembre 2013
I love yii and i don't know about any "inflexible" on it but Laravel looks great. Very good article too!

zxc 12 Enero
Kohana has genius code, all other frameworks suck.

Juan Carlos 15 Enero
I think that you are not a programmer and dares to make comparisons between framework, for you to make minimum compraciones must have used the Zend, Symfony, yii framework cake or work are backed by big business, it's my opinion. sorry for my bad English

mark 23 Enero
have you seen https://gist.github.com/anonymous/8565929 ? After that you might want to use anything except that one.

http://www.vladstudio.com/fr/post/?laravel---a-beautiful-php-framework-that-does-not-make-me-feel-stupid# 27 Enero
http://www.vladstudio.com/fr/post/?laravel---a-beautiful-php-framework-that-does-not-make-me-feel-stupid#

Rob 12 Febrero
Laravel is far better than CodeIgniter. It just ships with so much more out of the box. Not to mention Composer which allows you to easily keep it up to date. Faster development is much better than speed which is a non issue if you're developing something new. http://www.websanova.com/blog/laravel/10-reasons-why-laravel-is-better-than-codeigniter

fadilah ajiq surya 10 Marzo
this is so funny article #lol but great :p

fadilah ajiq surya 10 Marzo
it seems spongebob is using laravel too. i imagine that you said everything about other frameworks and nothing happen but when you said "laravel" and spongebob came down like an angel wkwkwk #LOL :))

B 25 Marzo
I find myself in a similar situation now as you when you wrote this article. I'm very curious to know what you think a year later?

Vlad Gerasimov 25 Marzo
B: I no longer do PHP programming, so I cannot either confirm or deny my thoughts from this post!

Al US 31 Marzo
Symfony is nice though ))

Sarath 7 Abril
It is true. I was on CI but when I moved to Laravel, it is working pretty well like I am working on the Ruby on Rails. I think Laravel must be the best choice for PHP Web Startup.

Robair 6 Mayo
Also check yii2, it's beta just realeased and it's looking really awesome

Ivana S. 11 Mayo
I would definitely go for Laravel. There is a new Laravel based Content Management System, called Doptor CMS. It's quite effective. You can build your website and any kind of application using doptor, both online and offline.

Daniel Jarosz 30 Mayo
Ha ha! The same story as mine :)_

abenson 26 Junio
Many of Laravel's components are derived from the Symfony framework. See: http://symfony.com/projects/laravel Both are very strong frameworks that embrace the convention vs configuration mentality. In either case, both frameworks will suit any application with any level of ambition. For my own 2 cents, any framework like CodeIgnitor hardly deserve mention. It's more like a framework for babies. Class loading is very clumsy and you'll find yourself doing a lot of menial busywork that aforementioned frameworks take care of for you. Be a big boy, choose a big boy framework like Symfony or Laravel. At least you won't get laughed at.

Optimus Prime 15 Julio
I learned CodeIgnitor very fast, with the help of it's beautiful arranged doc. But when I started with Laravel it sucks a lot!! I was not able to find good doc of laravel..

Greyhat777 28 Julio
I really enjoy reading your article. I played around with yii and later laravel. Both of the frameworks are awesome, but laravel is a real treat to work with for developers like myself.

Show all comments

Añadir comentario

1 2 3 4 5 6