Czerwiec 16, 2016 Technologie
I recommend Laravel
How to convince a programmer, administrator, project manager and client to use Laravel? We asked our programmers these questions as part of our internal contest. Today we’re presenting a piece written by Michał, which earned him a place among this year’s winners.
Internal contests with attractive prizes have become somewhat of a tradition at Polcode. This time at stake were entry tickets to the Laravel-themed Laracon conference, which is taking place this year on August 23-24 in Amsterdam. Not a random choice of a reward considering the theme of our content. Below you can read an article that earned one of our developers participation in this year’s Laracon:
L a r a v e l is a fairly young framework, created back in 2011 by one person – Taylor Otwell. He took it upon himself to create a tool that would be more advanced that CodeIgniter, but at the same time would allow developers to create and rapid-prototype apps in a much less complicated manner.
That’s how Laravel, a very popular PHP framework developed by over 320 programmers from all over the world, came to be. Laravel is a tool of choice to develop new apps as well as to rewrite existing apps for many programmers, project managers and clients. Due to its clear and uncomplicated structure as well as a plethora of ready-made solutions, it’s also easy to install in the production environment for administrators.
How to convince programmers from your team to use Laravel?
Laravel is a framework of choice for many programmers due to its clear syntax and modular structure. Since an app built with Laravel is split into a readable and logical manner according to the MVC pattern, you can build a startup project quickly, which can be then expanded easily and in short time intervals thanks to the modular approach.
Laravel’s biggest selling point is its readability. Thanks to its simple and clear syntax, you can build an app after which you can then improve and expand it in the future without wasting too much time. The Artisan tool helps programmers compose the initial structure of an app by creating a basic controller and and a model with a defined name straight from the command line. For example;
php artisan make:controller --resource BooksController php artisan make:model Book -m
These two commands allow you to create a container and a model along with a migration – once you add a migration, define routing and create views, you have a large chunk of a working app in just a few minutes.
Eloquent is yet another big asset of Laravel. It’s a dedicated ORM that provides access to both basic and more advanced functions, which allow you to conduct various operations on databases. Eloquent is compatible with MySQL, Postgres, SQLite, SQL Serves as well as Oracle, which are supported by additional community-made extensions. Eloquent provides many convenient functionalities such as Eager Loading, which optimizes database queries by retrieving an object and all of its relations with a single SQL query.
A lot of Laravel’s conveniences come out of the box. Blade is an easy-to-use templating engine and a built-in authentication system, which makes it possible to develop a web service that supports user registration in just 5-15 minutes. Cashier, on the other hand, simplifies the implementation of payment functionality. You can also use a built-in PHPUnit-based Unit Testing tool that can also be easily replaced with another according to your preferences.
What makes starting one’s journey with Laravel a treat is also easy access to a number of courses and tutorials as well as a solid and readable documentation that make it easy even for a total beginner to develop their first application. Some of the best resources on Laravel include Laracasts, tutorials on Scotch.io and the official documentation.
How to convince administrators to use Laravel?
Optimization and easy configuration – that’s all you need to convince an administrator to use Laravel.
Since the environment configuration files are applied from the very start of app development, you can manage the app easily and update it in the development, staging and production environment alike. Just about any Laravel module is supported by configuration files available in the
/config catalog, which means that adding extensions to the site is possible even without access to the server. The .env files are particularly useful when the deployment tools, which allow for automatic code update on the server through your Git repository, are applied.
On top of that, Laravel has built-in tools that simplify rapid app optimization. Aside of the previously mentioned Eager Loading functionality, which optimizes database queries, you also have access to built-in data caching and additional caching for the view layer, which is turned on by default.
Another big advantage of Laravel, which get many developers thinking is a relatively large number of tools that facilitate the deployment of code to a server as well as ready-made environments such as Homestead, designed by the creators of Laravel. One of the good examples of such deployment tools is Laravel Forge, also from Laravel creators. It greatly simplifies server setup – all you need to do with Laravel Forge is fill in a form, and it provides you with a one-click deploy with the Push to Deploy feature.
When it comes to optimization, Laravel holds its own against the Symfony framework that is developed by more programmers. While Laravel does use some of Symfony’s modules, its better optimized in some areas and as a result superior when it comes to server response time. It also consumes less resources.
How to convince project managers to use Laravel?
In order to convince your project manager (PM) to use Laravel, you can largely use the same arguments that I pointed out above, focusing on the framework’s efficiency and presence of a large community.
What’s more, Laravel is a framework that is relatively easy to learn for developers experienced in other frameworks, even non PHP-based ones. Interestingly, the 4.2 version of Laravel was very similar to the popular Ruby-based framework Ruby on Rails. Therefore, it’s safe to assume that even if your PM can’t find the right person to develop or take over a project in the gigantic Laravel community, they can find a suitable programmer elsewhere and then have the individual familiarize themselves with the framework fairly easily.
Existing Laravel-based projects also make a compelling case for the use of the framework. This relatively young project is eagerly used in large projects and by well-known companies. Putting services centered around Laravel, such as Laracasts and Larajobs, aside, one can still go on and on about them. They include the official website of the Fallout 4 game, Peak Cottages (the web service that offer catering accommodation for short and long breaks) and eNCA – a South African online news brand.
The presence of the substantial Laravel community that develops ready-made extensions means that one can create complex and scalable projects easily and in a relatively short time, even without many experienced Laravel programmers on board.
How to convince clients to use Laravel?
All of the arguments pointed out above without a doubt apply to the client. To make a good case, one can especially mention the readability of Laravel-based code, which makes it easy to get new programmers on board, and good optimization – the client can save more money on server resources.
Laravel is a framework suitable not only for large web services such as those I mentioned previously, but also for complex apps. Some of the most remarkable include the company management apps FusionInvoice and InvoiceNinja, status page systems such as Cachet as well as eCommerce platforms.
Much to your client’s joy, Laravel also supports many third-party solutions such as AWS, Stripe, Zendesk, Mailchimp or Paypal. Thanks to that, the implementation of external APIs will be much less time consuming than in the case of having to hire a team of programmers to write such an integration from the ground up. Again, the client ends up saving money that can be used to further develop the app.
To sum it up – why Laravel
As a final argument for the feasibility of Laravel as your framework of choice, I’d like to refer to the benchmark test by TechEmpower, in which Laravel is one of the top performers. While in some cases it’s outdone by smaller and more specialized frameworks, it fares very well against the most popular competitors developed by much bigger programming teams. That makes Laravel a feasible choice for small and big projects alike.
Michał Groele, PHP Developer at Polcode