Writing a web application was a lot different during the very early days of dynamic web than it is today. The task was lethargic and meticulous at the same time. Developers were responsible for writing the code for unique business logic of the application along with writing the code for components which are extremely common across a majority of the websites — input validation, database access, user authentication, templating etc. This was a time when everything was programmed with code, from alpha to omega.
Coming to the present, developers have a myriad of application development frameworks. When you hire PHP developer today for your application programming, he has literally thousands of components and libraries available at his disposal when writing the code.
Question is, why would you climb a particular mountain? Just because it is there might be a convincing answer. But in terms of framework there are better reasons to choose one over the other. But before that, let us clear the air considering if you need a framework at all.
Why utilize a framework?
When developing in PHP, developers know how important it is to use individual components and/or packages. Considering packages, a third-person altogether is responsible for completely developing and maintaining an isolated, individual piece of code which has a specified job. And by theory, that person or third-party has a better understanding of this single component compared to you as a developer.
In terms of frameworks like Laravel and Symfony, they come pre-packed with a huge collection of such third-party components. All the essential components like configuration files, prescribed directory structures, service providers, and application bootstraps are all glued together.
This clearly states that someone took the pain of not just compiling all the vital components together but also structured them, making sure how these components fit together.
Let’s say you want to make a sandwich. The most basic ingredient that you will need is bread. Rather than looking for flour, water, salt, yeast etc individually and then kneading all of them together before giving it a shape and putting it in the oven, you can quickly go to the nearest store and buy readymade bread of your choice. Someone has already done the work of gathering all the components required to make bread so that you don’t have to go over the process to make a sandwich.
Your focus should be on making the sandwich and gathering the ingredients required to make one. Nitpicking on the quantity of flour, water, yeast etc will take an unnecessary amount of time.
Frameworks are made exactly for this purpose. They provide conventions and features which drastically reduce the amount of time and code a developer spends in understanding the code. For instance, if a developer understands how routing works in any one Laravel project, he can understand how it works in all of the Laravel projects altogether.
Rolling and utilizing your own framework means picking up the ability to control what goes and what does not go into the foundation of your web application. A solid, good framework gives you the freedom to customize your heart’s content and provides a rock-solid foundation.
The Bandwagon of PHP Frameworks
In order to establish ‘why Laravel’, we should understand how Laravel came into the picture and what were previously known frameworks before Laravel. We saw the rise and fall of many frameworks before Laravel become so popular.
Ruby on Rails
The first version of RoR was released in 2004 by David Hansson.The framework was so dynamic that today is almost impossible to find a single web application framework which has not been influenced by RoR in some or the other way.
It was responsible for popularizing MVC, convention over configuration, Active Record, RESTful JSON APIs and many such tools which have a huge influence on web developers even today. It changed the way developers approached their applications.
The next wave in PHP frameworks
After a few years since the launch of RoR, it became clear to developers that Rails and many other similar web application frameworks will shape the world of development, they could foresee the future.
In 2005. CakePHP was launched followed by Symfony, Codeigniter, Kohana, and Zend. The next in line were Yii, Slim, and Aura. 2011 was the year when FuelPHP and Laravel saw the light of the day. They were launched as proposed alternatives to Codeigniter.
CakePHP and Codeigniter openly stated their inspiration about Rails. They accepted about how their ideas were widely drawn from Rails. Codeigniter shot to fame quickly since it was simple, easy to use, and had amazing documentation with a strong community. Unfortunately, Codeigniter’s use of modern technology and patterns was slow. The framework world was growing rapidly and PHP tooling started advancing. Codeigniter fell behind in terms of out-of-the-box features and technological advancements.
A man called Taylor Otwell became increasingly dissatisfied with the Codeigniter framework and began writing one of his own.
The Birth of Laravel
What sets Laravel apart from other frameworks? What is so special about it? Let’s discuss why this mountain is worth climbing from the entire range.
All you will need is to read through the available Laravel marketing materials and README docs to immediately start seeing its values. One look at Laravel and you will know that the two most important values it provides is to i) increase developer speed and ii) developer happiness. Laravel is completely about equipping and enabling the developers; providing clear, simple, and beautiful code and features which help developers rapidly learn, start, and develop, and start writing code which is elegant yet simple, clear and long-lasting.
Step-by-step developer happiness index achieved by Laravel
There are a few solid ways through which it makes the lives of developers a lot easier and much happier.
- First off, Laravel is a rapid application development framework, meaning that it focuses on a shallow learning curve and targets on minimizing as many steps as possible between starting a new application and publishing it.The components that Laravel provides makes it immensely easy to carry out most common tasks in web application development like database interactions, authentication, emails, caching, queues etc.
- The components of Laravel provide a consistent API and predictable structures across the entire framework. You can try anything new in Laravel and experiment with it, and you may hear yourself saying ‘this works!’
- Additionally, Laravel also provides a large ecosystem of tools to help you build and launch sophisticated applications. There are tools like Homestead and Valet for local development, Envoyer for advanced deployment, and Forge for server management.
- Laravel is based on the theory of ‘convention over configuration’. This means that if you want to use Laravel’s defaults, the work needed will be much less compared to other frameworks which require you to declare all of your settings. Simply speaking, projects built on Laravel take much less time to develop than compared to other PHP frameworks.
- Another aspect is that the creator of Laravel and the entire community is more inspired and connected with Ruby on Rails and other functional programming languages rather than Java. Even though PHP tends to incline more towards Java-esque aspects, Laravel stands on the other lane and embraces expressive, simple, and dynamic coding practices and language features.
- A beautiful aspect of Laravel is that it focuses on simplicity. While other frameworks might sometimes suggest using functions like dependency injection, mocking, repositories, Command Query Responsibility Segregation, Data mapper all sorts of complex structures, Laravel community and documentation makes start with the simplest possible implementation like global function, facade, ActiveRecord etc.This makes you as a developer to create simple applications that can solve the needs.
Official Packages provided by Laravel
1. Cashier:
Cashier is an expressive package with fluent interfaces to Stripe and Braintree’s subscription billing cooperation. Cashier helps in all of the boilerplate subscription billing code which is rather lethargic to write. The tool seamlessly handles coupons, swapping subscription, subscription “quantities”, cancellation grace periods, and helps in generating invoice PDFs.
2. Envoy:
Envoy, clean and elegant package providing a clean, minimal syntax for establishing common tasks you operate on your remote servers. As of now Envoy supports the Mac & Linux OS only.
3. Passport:
With Laravel you can do API authentication like a breeze. Passport gives a full OAuth2 server implementation for your Laravel application in no time. Passport is built on top of the League OAuth2 server.
4. Scout:
If you are looking for a simple, driver based solution for adding full-text search to your eloquent models, Scout is the tool you need. It syncs search indexes with eloquent records.
5. Socialite:
With Socialite you get a powerful, fluent interface to OAuth authentication with Facebook, Twitter, Google, LinkedIn, GitHub and Bitbucket.
Endnotes
Laravel helps you bring your ideas to reality, lets you waste no single line of code, and used ultra modern coding standards. The framework is surrounded by a spectacular community with budding enthusiasm and provides an empowering diaspora of tools. Above all, as a developer, you deserve to be happy. Hence, Laravel.