So, you want to build an eCommerce site using Laravel? Great choice! Laravel is one of the most popular PHP frameworks out there. It’s easy to use, clean to read, and powerful enough to handle an online store. In this tutorial, we’ll walk you through the basics. Whether you’re just starting or already a developer, this guide is for you!
Why Laravel for eCommerce?
Laravel makes development fun. It comes packed with features like:
- Routing — Easily manage URLs and pages
- Eloquent ORM — Smooth handling of database records
- Blade Templating — Clean and simple HTML views
- Authentication — User login and registration out of the box
Now let’s get your online shop rolling!
Step 1: Install Laravel
Make sure you have Composer installed. Then run this command in your terminal:
composer create-project laravel/laravel laravel-shop
Once it’s done, go into the project folder:
cd laravel-shop
Now fire up the built-in server:
php artisan serve
Open your browser and visit http://localhost:8000
. Boom! Laravel is running!
Step 2: Set Up Authentication
To let people register and sign in, run:
composer require laravel/breeze --dev
php artisan breeze:install
npm install && npm run dev
php artisan migrate
Now you’ve got basic auth ready. Users can now sign up and log in.

Step 3: Create Product Model and Table
Run this command to create a product model and migration:
php artisan make:model Product -m
Open the migration file in database/migrations
and define your product fields like this:
$table->string('name'); $table->text('description'); $table->decimal('price', 8, 2); $table->string('image')->nullable();
Now run the migration:
php artisan migrate
Step 4: Build Product Pages
Create a controller to handle the products:
php artisan make:controller ProductController
In your controller, add methods for showing products and adding to cart.
Now set up routes in routes/web.php
like this:
Route::get('/products', [ProductController::class, 'index']); Route::get('/products/{id}', [ProductController::class, 'show']);
And don’t forget to create views! Use Blade for sweet, simple HTML formatting. Display your products in a grid with images, prices, and an “Add to Cart” button.

Step 5: Shopping Cart Fun
You can store cart data in the session. Here’s a simple way:
- Create a CartController
- Add methods to add, remove, and update items
- Use
session()->put()
to store cart items
To make your life easier, you can use a package like Laravel Shoppingcart. Install with:
composer require darryldecode/cart
Step 6: Checkout and Payment
You can create a simple checkout page where users confirm their items and enter shipping info.
For payments, integrate Stripe or PayPal. Stripe setup is simple with Laravel:
composer require stripe/stripe-php
Create a route and controller for payments. Use the Stripe API to handle charges.
Step 7: Admin Dashboard
You’ll want to manage products, view orders, and more. Create an admin area with:
- Admin middleware
- CRUD pages for products
- Order management
You can also use Laravel Nova for a ready-made admin system (but it’s paid).

Wrap Up
And just like that, you’ve got the foundation of a Laravel-powered eCommerce site!
You learned how to:
- Install and set up Laravel
- Add authentication
- Create product models and views
- Handle carts and checkout
There’s still so much you can add — discounts, shipping, inventory tracking, and more. But with this guide, you’re off to a solid start.
Happy coding and have fun building your eCommerce empire! 🎉