Getting Started with Laravel
Written By Aziz SamratJuly 7, 2023
Laravel is a PHP framework that makes building web applications faster and more enjoyable. When I started learning it, the number of new words was overwhelming: routes, controllers, models, migrations, Blade, Eloquent, middleware. But after building a few small projects, I realised that Laravel is really about one simple idea: put each piece of code in the place where it belongs. Routes decide which URL runs which code. Controllers handle the request and decide what to do. Models talk to the database. Views show the result to the user. Once you understand this flow, the rest of the framework becomes much easier to learn. In this post I share the path that worked for me, the order I learned things in, and the mistakes I would avoid if I started again today. If you already know basic PHP and a little HTML, you are ready to begin. You do not need to know everything before you start; you only need to build something small and keep improving it step by step.
Start by installing PHP, Composer and a database such as MySQL. Then create a new project with Composer and run php artisan serve to see the welcome page in your browser. Spend some time looking at the folder structure: routes, app, resources and database are the folders you will use most. Do not try to understand every file on day one. Instead, create one route that returns a simple view, then pass some data from the route to the view. Seeing your own text appear on the page is a great first win, and it shows you how requests travel through the framework.
Models, migrations and CRUD
Next, learn migrations and Eloquent models. A migration describes a database table in PHP code, so your whole team can create the same tables with one command. A model represents one row in that table and lets you read and save data without writing SQL by hand. Build a tiny CRUD app, like a task list or a product list, where you can create, read, update and delete records. This one exercise teaches routes, controllers, validation, models and views together, and it is the foundation of almost every real Laravel project I have worked on.
Validation and authentication
After CRUD, focus on validation and authentication. Laravel's form request validation keeps your controllers clean and gives users clear error messages. For login and registration, start simple and understand how sessions, middleware and password hashing work before reaching for a package. When I built a role-based authentication system without any package, I learned more about Laravel's middleware and gates than any tutorial taught me. It took longer, but the understanding stayed with me and made every later project easier.
Going further
Finally, connect Laravel to a modern front end and real services. In my daily work I use Laravel as an API with Vue and Nuxt on the front end, and I integrate third-party APIs such as the Meta Graph API for posting to Facebook Pages. Queues and scheduled commands let the app do heavy work in the background, like syncing deals or publishing posts at a set time. You do not need all of this at the beginning, but it is good to know where the road leads. My advice: build small projects often, read the official documentation, keep your code simple, and write down what you learn. Explaining a topic in your own words is one of the best ways to understand it, and that is exactly why I started this blog. Happy coding!