Why Laravel is so popular? (cheatsheet included)
Cheat sheets are wonderful resources for developers because they make it easy to find the correct syntax, command, or keyboard shortcut that you often forget. Cheat sheets are especially useful when you are a begginer in a new programming language or framework so they make the essential parts of the manual into just a couple pages. Since the documentation of programming language is detailed, cheatsheets may be helpful to find information faster. This cheatsheet is helpful for PHP developers who are using Laravel framework.
If we have a look at Google trend comparisons ,there is no doubt that Laravel is the most popular PHP framework of 2016.
Why Laravel framework is the best?
Laravel functionality depends on a lot of external packages . To do this, you need to use composer as dependency manager.It is easy for begginers to start new laravel set up easily.To run new laravel project simpy run this code on your command line :
composer create-project laravel/laravel your-project-name 4.2.*
Artisan is a powerful tool because it has the ability to run different tasks from command line.Just typing “php artisan” in your command line and you will see available commands.
Most of the developers face problems to keep database synced between development machines. With Laravel DB migrations , it is extremely easy. What’s more you can undo your changes with
php artisan migrate:rollback to rollback the last database migration.If you want to rollback all database migrations , simpy run
php artisan migrate:reset on your command line .
Laravel includes simple method for testing data using Database Seeder . Seed classes may have any name as you wish , but probably should follow some sensible convention , such as UsersTableSeeder, etc.
Laravel artisan’s tinker is a REPL . repl stands for read–eval–print loop is known as interactive top level or language shell by the fact that is takes single user inputs (i.e. single expressions), evaluates them , and returns the result to the user.
MVC stands for Model-View-Controller. MVC pattern contains three components :
The model — Models are typically permanent data that are stored outside the application, often in a database. A model enforces all the rules that apply to that data before saving them to database. For example, if a discount shouldn’t be applied to orders of less than $10, the model will enforce the constraint. This makes sense; by implementing these rules in the model, we make sure that application makes our data valid. The model acts as both a gatekeeper and a data store.
The view — View is the visual representation of given context from its model. It’s usually markup that framework renders to the browser using markup language, such as HTML.Even though the view may present the user with various ways of inputting data, the view itself never handles incoming data. The view also sends user action (e.g from submit) to the controller.
The controller — Controller provides the link between the view and the model. The controller is responsible for processing input, acting upon the model, and deciding on what action should be performed, such as rendering a view or redirecting to another page.
If you want better understanding of MVC pattern , check out this video.
Full Laravel cheatsheet : Click here
Originally published at www.ventrise.com.