Simple comparative analysis of Ruby on rails and laravel

Time:2020-2-8

At present, there are many popular frameworks for online web application development. There are also many different types of frameworks, such as those with a large number of plug-ins, which can let you iterate more quickly (such as rails), or other very simple and low-level (such as flask)
Two relatively more popular frameworks in web application development are Ruby on rails and laravel. Both of them are very mature projects and have been available for quite a long time. Ruby on rails was introduced in December 2005, while laravel was introduced in February 2012
At the time of the first release as shown above, laravel is younger, but rails is not too old, because the community has been innovating and constantly iterating projects by introducing newer, smarter and better tools. The same laravel is growing very fast
Developers care about a very small and simple indicator, that is, the number of stars of projects on GitHub. Ruby on rails has accumulated 22000 in more than eight years, while laravel has about 11000 in only two years. However, because PHP is a more common language than Ruby on rails, this achievement has been very good
In the future, we will take a quick look at the various components that are very important in the design and development of web applications, as well as the frameworks that are not recommended or recommended to be used in these components. Our selection criteria are based on our own concerns as developers. In this article, we discuss how easy it is to get started with Ruby on rails and laravel

Introduction

One of the criteria for our choice is how easy it is to get started with a framework. In this case, it’s basically to see how quickly you can start writing your web application code
Rails
With rails, you need to install Ruby on the machine. All you need to do is run the following command:


$ gem install rails

With this simple command, it will get all the dependencies of Ruby on rails and install them on your machine. With most OS X pre installed ruby, Linux is already a ruby command installed on your machine, which makes the installation easier
If you want to have an Ubuntu 14.04 lts service with Ruby on rails on our cloud service, all you need to do is start a new server, log in, install Ruby and then install rails. That’s easy


$ nova boot --flavor nb.2G --image "Ubuntu 14.04 LTS" --key-name MacBook rails-dev
$ nova ssh rails-dev
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-29-generic x86_64)
 
* Documentation: https://help.ubuntu.com/
[email protected]:~# apt-get update
[email protected]:~# apt-get install -y ruby ruby-dev make
[email protected]:~# gem install --no-ri --no-rdoc rails

All you need to do to install rails. Once it’s installed, you just need to create a new application and start playing with it. This is probably the easiest part


$ rails new weblog

To start the built-in Ruby on rails server, you just need to switch to the project path and use the command line to start the built-in server


$ rails server

Now you’re ready to process service requests and write your web application code. This process, including installing ruby, can take no more than 5 minutes at most. How can you install everything? It’s likely to start in a minute
Laravel
PHP is probably the easiest language for web developers to understand. One of the reasons is that PHP can be used as a language for processing services on the server side. However, limited to the scope of this article, we assume that users can run it on their machines or on a server. And its powerful entry advantage is that it can be used on most typical hosting platforms
PHP will be installed on OS X by default, and it can be easily installed on any machine. Laravel also has an extremely simple and easy-to-use installer
If you want to get an Ubuntu 14.04 lts environment with laravel on our cloud service, you just need to create a server, install PHP on it, and simply run the following command
 


$ nova boot --flavor nb.1G --image "Ubuntu 14.04 LTS" --key-name MacBook laravel-dev
$ nova ssh laravel-dev
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-29-generic x86_64)
 
* Documentation: https://help.ubuntu.com/
[email protected]:~# apt-get install -y php5-cli php5-curl php5-mcrypt
[email protected]:~# php5enmod mcrypt
[email protected]:~# wget -O /usr/local/bin/laravel http://laravel.com/laravel.phar
[email protected]:~# chmod +x /usr/local/bin/laravel

The next step is to create an application. The process is as simple as installing rails


$ laravel new weblog

If you want to use the built-in PHP development server, all you have to do is run the following command under your application path:


$ php artisan serve

That’s it. Now you can go to the website provided and start writing your application. The whole process takes about five minutes to install the environment, and you can start a new project in one minute

summary

It’s very easy to get started with both applications. It only takes 5 minutes to set up from scratch. If you have both installed them, it will take less time. This means that it will take less time to get the development environment and take more time to solve practical problems