What is Laravel? Explain it like I’m five.
So you’ve kind of heard about Laravel. You’re maybe considering learning it, but there are just too many things to take into account. Tinker? Artisan? Composer? Why does everything sound like character classes in an RPG game?
This is by far no definitive guide, but if you’ve ever asked yourself “why should I bother with all this stuff”, read on for some of the most asked questions when starting out with Laravel.
What is Laravel and why it is used?
Laravel is an open-source PHP framework designed to make developing web apps easier and faster through built-in features. These features are part of what makes Laravel so widely used by web developers:
- A modular packaging system with dependency management. This means you can easily add functionalities to your Laravel app without writing them from scratch. You can either create your own packages for code you routinely use or install ready-to-use packages through Composer.
- A complete authentication system
- Object-relational mapping. Eloquent ORM included with Laravel presents database tables as classes for easier data access and manipulation.
- A command-line interface (CLI) that comes with dozens of pre-built commands (Artisan).
- Automatic testing. Automated tests are provided as an integral part of Laravel.
- A portable, virtual development environment. Homestead provides developers with all the tools necessary to develop Laravel straight out of the box.
Is Laravel frontend or backend?
The short answer is “backend”. The long one: Laravel is a server-side PHP framework; with it you can build full-stack apps, meaning apps with features typically requiring a backend, such as user accounts, exports, order management, etc.
What is MVC in PHP Laravel?
MVC (Model-View-Controller) is an architectural pattern used to break down an app into three fundamental parts: data (Model), an interface to view and modify data (View), and operations that can be performed on the data (Controller).
Think of it as ordering a pizza. You call with a user request for Pepperoni pizza. As soon as your request is registered, the person who makes the pizza (the Controller) deconstructs it into a series of steps: grab the dough, fire up the oven, and sprinkle the grated cheese. The Controller can only use the limited resources it has at his disposal, this limited toolset being the Model: hands, oven, pizza tray, etc. Finally, you receive the pizza, which is a wonderful View.
This way of structuring an app is useful because it keeps things separated into logical areas. This makes your code more organized, less fragile, and easier to debug. Laravel implements MVC architecture as part of its design.
Can I learn Laravel without PHP?
Laravel is PHP at its core, so learning Laravel without having a good grasp of PHP is not very productive. You will not be able to create additional functionalities and you will be completely dependent on the one’s Laravel ships as part of the framework. The bottom line, you need PHP and OOP concepts to understand what’s going on under the hood and to use Laravel to its full potential.
Is Laravel easy to learn? What is the best way to learn Laravel?
Laravel is considered to have a short learning curve, especially if you’re already familiar with PHP. Even when stuck, the community is really helpful and there are a plethora of resources to help you learn Laravel from scratch, from podcasts and videos to written tutorials.
A good way to learn Laravel is to read the documentation, follow some of the gurus online, such as Taylor Otwell, Jeffrey Way, and Freek Van der Herten, go through the tutorials out there and follow along. Finally, start building your own project and google things as you go.
Is Laravel a CMS?
Unlike CMSs like Drupal or WordPress, Laravel gives you full control over your application. In Laravel everything is done in code, unlike Drupal or Joomla, for example, where you can create functional websites without writing a single line of code or without even knowing what PHP is.
Simply put, a CMS is an app that comes with basic functionalities and is built on top of a framework. Laravel is a framework it’s used to build apps, including CMS platforms.
While there’s no shortcut for learning anything, especially programming, there are ways of making it worthwhile. You don’t need to become a Laravel guru overnight. Don’t stress over learning every component by heart before you can start writing code. Experiment, try things out, and learn one new thing every day.