You are not logged in.

Important Note: This forum is being archived and will be completely locked down on the 7th of February. The new forum can be found at http://laravel.io.

Announcement

    Laravel 4 Advanced Architecture: Book Now On Sale

#1 2012-10-07 22:01:40

Rups
Artisan
Registered: 2012-06-21
Posts: 290

Laravel vs. Ruby on Rails

Hi,
I had a discussion with a guy at school last week. He loves his Ruby on Rails framework, and think all the PHP related stuff are crap. As most of the Ruby on Rails developers, like he said.
But why. I think PHP itself is not really a pretty language to develop in, but with the Laravel Framework I love to write PHP. Before I developed most of the things in C# .NET. PHP with Laravel is so much faster. And still I want to learn some Ruby, and develop with the Rails framework. I showed the guy some code and he admits that Laravel looks a bit like Ruby on Rails in the way of code.
What about you guys, are there some RoR developers here? And do they prefere RoR of Laravel? And why? And is RoR really so much faster then PHP (Laravel)?
I'm interested if the the syntaxes are similar. This week I'll buy some books as well, to give it a chance.
Or is it more interesting to learn Python Django?

Last edited by Rups (2012-10-07 22:09:47)

Offline

#2 2012-10-08 01:47:01

Bung55
Artisan
Registered: 2012-09-17
Posts: 25

Re: Laravel vs. Ruby on Rails

I have one initial comment.....
Deployment!

Offline

#3 2012-10-08 05:27:36

msurguy
Artisan
From: United States
Registered: 2012-04-11
Posts: 415
Website

Re: Laravel vs. Ruby on Rails

I wrote a blog post about this recently, not too much, but some reasons why I switched from RoR to Laravel are available here : http://maxoffsky.com/code-blog/laravel- … -on-rails/

The ease of use, very expressive syntax, no need for tons of books (cuz everything just makes sense), etc...

Offline

#4 2012-10-08 06:03:11

Zizaco
Artisan
Registered: 2012-09-14
Posts: 106
Website

Re: Laravel vs. Ruby on Rails

Hey Rups

I'm working with Ruby on Rails for about 1 year now.
But for my side projects I use Laravel. And I will tell you why:

Rails is an amazing framework and Ruby is a very cool language. They introduced many "revolutionary" concepts to the web-development world and that's why they got that huge ammount of fans and fan-boys.

But Ruby on Rails always had (and still have) some drawbacks. Performance, blocking requests, memory usage/leak, complex deployment e maintance. (There are some other things that some people consider drawbacks like "conventions to the bone", but that is more about personal taste I guess)

In other hand the Rails introduced the so called "Web-development that doesn't hurt". Which is to focus more in the simplicity and the "flow" of the development than in the configurability and the complexity of the thing.

As it says in the official website, "Rails is optimized for programmer happines and sustaintable productivity", which means, that they prefer to make easy to code over the resulting application being fully optimized. That's why the "enterprise world" refuse to embrace Rails. They think that "Rails developers are lazy and prefer an easy to do thing over a good final result", which kind makes sense at some point.

The fact is that, those cool concepts that Rails introduced have little to do with the framework itself or with the language (maybe a little, because ruby is really clean but slow, which reflects the "optmized for happines" thing). Alot of people figured out those cool ideas and incorporated then into non ruby things. Thats where Laravel comes into the game.

Now a days you can find all the Rails advantages into PHP frameworks but without those drawbacks that the ruby language have. The Rails fans ( or should i say fan-boys) that think that the PHP world is far behind are blind by the awesomeness that Rails invented years ago. They didn't noticed that those features could be easy implemented into other languages/frameworks once the people find out that the concept is good.

Rails:
ActiveRecord, Migrations, Generate, Gems, Restful and Conventions.

At "Laravel's World" we have:
Eloquent, Migrations, Bob/Jeffrey'sWay Generate, Bundles, Restful and Conventions.
Laravel is spanking faster than Rails. Much easier to deploy, debug and customize. And don't have the drawbacks of the ruby language. Plus is much easier to find PHP programmers to teach Laravel than Rails programmers (at least in my country). So in the bussiness perspective, Laravel (or any other PHP framework) is a better choice too. At the company that I work they can't find enough ruby programmers to attend the demand of production.

Other than Laravel there is some other modern frameworks that delivers all the Rails features in PHP. FuelPHP is very cool for example, you should check it out.

Thats my opinion.

PS: If I express this opinion at my job they will accuse me of heresy and set me on fire.

Offline

#5 2012-10-08 06:38:21

bngreer
Artisan
From: San Diego
Registered: 2012-09-26
Posts: 21

Re: Laravel vs. Ruby on Rails

I started in django, then learned php, then rails. The biggest difference between them, is going to be the community they serve. I'm afraid your comparing paradigms that will never fully compare

Personally, I think that laravel is the best php framework for "most" projects in php. But it will never replace rails because it doesn't serve the same needs.

django vs rails is a little more natural comparison, but that is mostly a language difference the more you look into it.
django and rails have the advantage of being able to swap out the webserver component in ways that php can't(yet), and in production systems can be optimized to be very fast because of it. But php is king in the cheap servers department.

My cheap subjective summary about the coding style would be:
Laravel: expressive and easy to read code. The best you could hope for in ugly php
Rails: elegant and minimal code. Conventions to a fault
Django: pragmatic


I'll resist saying more than that as this is sure to be an unproductive topic

Last edited by bngreer (2012-10-08 07:24:31)

Offline

#6 2012-10-08 07:50:57

Zizaco
Artisan
Registered: 2012-09-14
Posts: 106
Website

Re: Laravel vs. Ruby on Rails

bngreer wrote:

django and rails have the advantage of being able to swap out the server in ways that php can't(yet)

Since the PHP have an CLI you have basically the same control level that you would have with other languages.

I'm developing a web Application that host git repositories (much like GitHub), and i'ts made with Laravel. All the repository management code (init, set permissions, deployment, cache repository content to show in web interface, etc) is also made with PHP and run Asynchronously (in another thread) trought artisan commands (so it doesn't block the user response).

(Correct me if I'm wrong) In Rails I would have no choice other then running it in the same thread. Blocking the user and a whole ruby istance in passenger before delivering the "success" or using a completly third-party library like resque or run a non Rails thread (like GitHub do) for optimal performance and use some kind of cache to "talk" with the original instance.

As far as I know starting another thread in Rails and using the stuff that "should be in memory" (active record, model rules, etc) in a Rails request is totally instable and non recommended. Thats why Rails apps needs alot of RAM and "bandages" like passenger that run a whole instance for just one concurrent request.

Because PHP is a domain especific language (made to answer requests as fast as possible using the "share nothing" concept) it doesn't have those problems. And can handle concurrent threads in the same request easly while sharing values using cache. I do it in my App. I use the whole set of Laravel functionality, like Eloquent in another thread without break or eat the RAM out.

I don't know about Django but I know that python is much faster than ruby and have a much better mult-thread support.

bngreer wrote:

I'll resist saying more than that as this is sure to be an unproductive topic

me too

Last edited by Zizaco (2012-10-08 07:52:48)

Offline

#7 2012-10-08 08:30:39

Kaspien
Artisan
From: Albuquerque, NM
Registered: 2012-06-03
Posts: 61

Re: Laravel vs. Ruby on Rails

Zizaco wrote:

I'm developing a web Application that host git repositories (much like GitHub), and i'ts made with Laravel.

I so want this! Please, let us know when this is complete and available, because I would happily pay for an app like this. I've thought about using GitLab, but my current host won't allow me to run Ruby and PHP apps at the same time on the same account. And I'm not about to switch hosts or create a second account just to run my own instance of a GitHub clone.

Offline

#8 2012-10-08 16:16:34

Zizaco
Artisan
Registered: 2012-09-14
Posts: 106
Website

Re: Laravel vs. Ruby on Rails

Kaspien,

Sure i will wink

Last edited by Zizaco (2012-10-08 16:16:53)

Offline

#9 2012-10-08 23:17:26

bngreer
Artisan
From: San Diego
Registered: 2012-09-26
Posts: 21

Re: Laravel vs. Ruby on Rails

Zizaco wrote:
bngreer wrote:

django and rails have the advantage of being able to swap out the server in ways that php can't(yet)

Since the PHP have an CLI you have basically the same control level that you would have with other languages.

(Correct me if I'm wrong) In Rails I would have no choice other then running it in the same thread. Blocking the user and a whole ruby istance in passenger before delivering the "success" or using a completly third-party library like resque or run a non Rails thread (like GitHub do) for optimal performance and use some kind of cache to "talk" with the original instance.

As far as I know starting another thread in Rails and using the stuff that "should be in memory" (active record, model rules, etc) in a Rails request is totally instable and non recommended. Thats why Rails apps needs alot of RAM and "bandages" like passenger that run a whole instance for just one concurrent request.

Um, that's pretty far off actually. Rails has the rack interface. You can swap out the webserver cleanly with whatever suits yourapp, just change the gem. Thin, mongrel, unicorn, puma, etc. Unicorn is well proven stable and super fast(uses a preforking model, which is different from single threaded blocking AND non-blocking node.js styles you mentioned)

passenger is hardly a bandage.
Active record and model rules are logically "per request" . Pretty much every MVC creates a new instance of those for every request, including laravel.
The modules loaded in php.ini are shared between requests(depending on specifics, of course) not the application code.

With good tuning, you can share a single DB connection and reuse your http connections in an extremely efficient manner. PHP's webserver is a builtin feature of the language. So it has some advantages with things like mysql having a highly optimized(many years) connection to the core of the language, but it still uses webserver techniques from the 90's and is not going to change anytime soon. Hardly cutting edge. But then again it's served billions of pages, so who cares. It's stable solid and fast.

Zizaco wrote:

Because PHP is a domain especific language (made to answer requests as fast as possible using the "share nothing" concept) it doesn't have those problems. And can handle concurrent threads in the same request easly while sharing values using cache. I do it in my App. I use the whole set of Laravel functionality, like Eloquent in another thread without break or eat the RAM out.

PHP is fast and efficient because it shares a lot of libs and connection resources. Node.js is more efficient because it shares even more. I can tune python or ruby environment to be 10x faster than stock by carefully sharing more resources, instead of loading a new instance for ever request. Starting a new thread for every request as is typical in many php/apache setups is slow, "green threads" are much faster.

I'm not entirely sure what you mean by the "shared nothing concept". That sounds like something from erlang or one of the other functional languages, not PHP.

Zizaco wrote:

I don't know about Django but I know that python is much faster than ruby and have a much better mult-thread support.

um, what?
None of them are consider to be fast languages, why are we discussing this?
stock python and stock ruby are about the same. Stock PHP is a little slower.
Python has poor threading support, GIL issues and all. That's a part of why you would use uwsgi. Only uwsgi doesn't use multithreading out-of-the-box
Ruby has the same GIL issues, but it  has better(somewhat subjective) webservers available( unicorn, puma, etc).

If your running stock in production then you don't care about speed. You would at least use a bytecode accelerator or something. PHP has xcache, python has pypy, ruby has it's own way of things......
Then there's all the cool DB connection optimizations you can do(e.g. connection pooling )
And all that without even touching your application code!

Remember, these are all hugely popular language and frameworks to build solid, scaleable, production web apps in. Anybody who tells you they are slow, is ignorant.

"There are lies, damn lies, and then there are benchmarks..."

Having said all that let's think about what is really the question here, should you use laravel?

a. Laravel is fast, to develop in.
    It has an extremely easy to read coding convention and a well thought out API. " It's Expressive "
b. Laravel is fast, in production.
    It uses a dependancy injection pattern quite frequently. So instead of loading the entire class library, only the code that is need is used.
c. Laravel is fast, to debug.
    If you don't know, just trust me on this one
d. Laravel is fast, to learn
    Try it for a day, you'll have something that is running by then.
e. Laravel is modular
    And it still maintains it's efficiency! whoah.

Laravel is PHP. Aside from javascript. it's the most ubiquitous language ever. In an economy where 8% of us are unemployed, choosing a solid language like PHP is a really good option, there will ALWAYS be an entry level position open for you.

Last edited by bngreer (2012-10-08 23:22:54)

Offline

#10 2012-10-08 23:52:24

Franz
Administrator
Registered: 2011-11-13
Posts: 758

Re: Laravel vs. Ruby on Rails

bngreer wrote:

b. Laravel is fast, in production.
    It uses a dependancy injection pattern quite frequently. So instead of loading the entire class library, only the code that is need is used.

Slightly off-topic, but just so I can understand you:

What is the performance benefit of dependency injection? Or do you mean things like an inversion of control container that only creates instances when truly needed?


FluxBB Core Developer - trying my best to break this forum everyday :)

Offline

#11 2012-10-09 01:31:24

Zizaco
Artisan
Registered: 2012-09-14
Posts: 106
Website

Re: Laravel vs. Ruby on Rails

bngreer, nice points.

bngreer wrote:

PHP is fast and efficient because it shares a lot of libs [...] stock python and stock ruby are about the same. Stock PHP is a little slower.

And because of that the so called "Stock PHP" you see in the benchmarks is slower. Being domain especific language for web-requests means that it's not optmized to CLI so it loads many libs even if then will not be used to respond to a CLI call.
For example: An PHP CLI call includes database libraries, among other things, while a Ruby call will not include any database related stuff by default. But once again: We are talking about web-applications. This explains the "a little slower".

bngreer wrote:

PHP is fast and efficient because it shares a lot of libs and connection resources. Node.js is more efficient because it shares even more. I can tune python or ruby environment to be 10x faster than stock by carefully sharing more resources, instead of loading a new instance for ever request. Starting a new thread for every request as is typical in many php/apache setups is slow, "green threads" are much faster.

In fact, native threads faster then green threads. Green threads can be started faster, which is good for an webserver.
Nginx/PHP setup is much faster then Apache. Nginx doesn't rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. Which is basically a green thread for each request. http://tengine.taobao.org/images/benchmark.png. Don't forget that PHP environment can be tweaked to be alot faster too.
PS: I bet that your "10x faster recipe" involves NginX too (;

bngreer wrote:

I'm not entirely sure what you mean by the "shared nothing concept".

Practically, it means that whenever a user opens a request to the server, a new PHP process is invoked which retains a distinct "user-space" environment. The memory of one PHP process is never be shared with another PHP process. Exept for the php libs or by using external cache.

bngreer wrote:

Python has poor threading support, GIL issues and all. That's a part of why you would use uwsgi. Only uwsgi doesn't use multithreading out-of-the-box

Didn't knew this. I see that I need to study python sometime.

Anyway... i will just leave this here:
http://www.sjgames.com/svtarot/net/flamewar.gif tongue

bngreer wrote:

Having said all that let's think about what is really the question here, should you use laravel?

a. Laravel is fast, to develop in.
    It has an extremely easy to read coding convention and a well thought out API. " It's Expressive "
b. Laravel is fast, in production.
    It uses a dependancy injection pattern quite frequently. So instead of loading the entire class library, only the code that is need is used.
c. Laravel is fast, to debug.
    If you don't know, just trust me on this one
d. Laravel is fast, to learn
    Try it for a day, you'll have something that is running by then.
e. Laravel is modular
    And it still maintains it's efficiency! whoah.

Totally agreed (:
for sure I will quote this statement sometime!

edit:
Result: www.zizaco.net/2012/10/rails-vs-modern-php-frameworks/

Last edited by Zizaco (2012-10-10 02:02:21)

Offline

#12 2012-10-09 02:14:58

lavaeagle
Artisan
From: Seattle, WA
Registered: 2012-07-08
Posts: 189
Website

Re: Laravel vs. Ruby on Rails

I recently had to develop an application quickly and wanted to try out Ruby versus Laravel.  The internet was full of tutorials for PHP and setting up the server.  I tried following the Ruby tutorials but it was just such a pain.  So I said to hell with it PHP will let me get this done quicker.  Installed MAMP, downloaded Laravel.  1 awesome app later I'm still incredibly happy I chose Laravel.  I'm making all kinds of cool stuff fast.

Just to test laravel's speed I built amifriendly.com which took me somewhere around 8 - 10 hours.

Last edited by lavaeagle (2012-10-09 02:15:43)


lavaeagle == @michaeljcalkins

Offline

#13 2012-10-09 07:18:38

ShawnMcCool
Quality Team
From: Utrecht, Netherlands
Registered: 2011-10-05
Posts: 535
Website

Re: Laravel vs. Ruby on Rails

Rails has better testing and support for things like fixtures. But, i think that overall people who use Rails do so because they find the experience more aesthetically pleasing. It's hard to argue with that. I see the difference between PHP and Ruby as the difference between Laravel and CI. You can make a site in CI but you're locked into a system that prevents you from either creating elegant algorithms or improving upon your software architecture. The freedom offered by Ruby over PHP for object-oriented design is higher and I feel that Ruby offers a more aesthetic design / usage experience. One could try to quantity that aspect and / or make arguments against its validity. But, I find Rails to be quite reasonable overall.

I'm invested in PHP in a way that I'm not invested in Rails. I know PHP better and I know more PHP frameworks than Ruby frameworks. I've been using PHP for ~14 years and Ruby can't compete with that. I'm excited about the shift to modularity using Composer and I think it'll be a fun ride.

But, on an academic level Rails is certainly important to our profession. A year or two back I was a very active member of the CI community and basically Rails was shrugged off as too much magic under the hood. (Many things were, actually) I don't really see a need for this kind of perspective, and I'm not suggesting that people here have it. I just think that we should be getting dirty experimenting with as much as possible so that we can see through the sound-byte style arguments and find new perspectives with which we can create software.

Web-development shouldn't be locked into rigid rudimentary structures that prevent elegant design. Our language and framework choices need to support our ability to grow as software designers and in a lot of ways I think that Ruby is able to support more than PHP in that regard. However, like I said.. I think Composer brings something powerful to the world of PHP. I think that PHP is a quite powerful web-development language as it was designed to be so. Unfortunately, I think that it's also bogged down by its incredibly wide-spread success and I find it hard to imagine that PHP will catch up with other languages (from an architectural capability perspective) any time soon.

In general I'm discontent with the state of web-development in general and the state of web-development with PHP general. I find that Laravel improves the experience and that's why I'm here and why I advocate it so heavily. It is software that effectively can improve our lives and help us grow in our profession. But, I don't see web-development NOT being a mess any time soon. It's best if we try to become familiar with as much as we can so that we can learn lessons from experiences that we'd otherwise not be exposed to.

Anyway, sorry for rambling. It's too early in the morning for me to focus.


Note: I tend to speak in hyperbole.

About Shawn McCool | About Big Name | BigTo.Do - FreshBooks time tracking for to-dos | Laravel IO - The Official Laravel Community Portal

Offline

Board footer

Powered by FluxBB

');