Laravel in 2 minute read

Awang Trisakti
2 min readMar 18, 2023

--

Image from https://www.logique.co.id/blog/2020/10/01/laravel-8/

Laravel is an open source PHP web framework that created by Taylor Otwell in 2011. It is designed to be a web framework with expressive and elegant syntax. Laravel provides a structure and starting point for create application.

Laravel follows Model-View-Controller architecture which separates three interconnected components model, view and controller. Model represent the data that can live in a wide variety of database while view is what the end user sees and controller is the connector of them.

Getting started
To get started, install php and composer then create a new laravel project using composer create laravel/laravel project-name and it will create the laravel project with the structure like image below.

Project structure

Write your routes in routes/web.php for web routes or routes/api.php for api routes. Create a controller file to handle the requests from routes that defined before. For database connection instead using a raw queries, laravel provide an ORM (object-relational mapper) called Eloquent so each database table has a corresponding “Model”. Laravel also has a templating engine called blade which is a php and html in a single file that you can render from the controller or anywhere.

Routes in web.php
Controller
Person model
View file

Run php artisan serve to start your apps

Thank you for read my post, please feel free to leave comments for any suggestions or questions. Share if you find this post useful. See ya

References
-
https://laravel.com/
- https://en.wikipedia.org/wiki/Laravel

--

--

No responses yet