Filament PHP: The Complete Beginner’s Guide (2025)

Author

Kritim Yantra

Mar 30, 2025

Filament PHP: The Complete Beginner’s Guide (2025)

If you're looking for an easy way to build admin panels in Laravel without writing tons of code, Filament PHP is the perfect solution!

In this step-by-step tutorial, we’ll cover:
What Filament is and why it’s awesome
How to install and set up Filament
Creating a full admin dashboard
Managing data with CRUD operations
Customizing your admin panel

By the end, you’ll have a working admin panel—no advanced coding skills needed!


What is Filament PHP?

Filament is a free, open-source admin panel builder for Laravel. It helps you quickly create:
🔹 User dashboards
🔹 Database management systems
🔹 Content management panels

Why Use Filament?

No frontend coding (uses Livewire & Tailwind)
Pre-built forms, tables, and widgets
Super fast to set up
Great for beginners & pros alike


Step 1: Installing Filament in Laravel

Prerequisites

  • Laravel 10+ (or Laravel 12)
  • PHP 8.2+
  • Composer

1. Create a New Laravel Project

composer create-project laravel/laravel filament-demo
cd filament-demo

2. Install Filament

composer require filament/filament:"^3.3" -W

3. Set Up the Admin Panel

php artisan filament:install --panels

This creates:

  • A new /admin route
  • Default Filament admin files

Step 2: Creating an Admin User

Run:

php artisan make:filament-user

Enter your name, email, and password.

Now, start the server:

php artisan serve

Visit http://localhost:8000/admin and log in!


Step 3: Building a Product Management System

Let’s create a simple product manager (like a mini e-commerce dashboard).

1. Create a Product Model & Migration

php artisan make:model Product -m

Edit the migration (database/migrations/..._create_products_table.php):

Schema::create('products', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->text('description');
    $table->decimal('price', 8, 2);
    $table->timestamps();
});

Run the migration:

php artisan migrate

2. Generate a Filament Resource

This creates CRUD (Create, Read, Update, Delete) operations automatically!

php artisan make:filament-resource Product --generate

Now, visit /admin/products—you’ll see a ready-to-use product manager!


Step 4: Customizing the Admin Panel

1. Changing the Brand Logo

Edit app/Providers/Filament/AdminPanelProvider.php:

use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        ->brandName('My Shop Admin')
        ->brandLogo(asset('images/logo.png'));
}

2. Adding a Dashboard Widget

Create a new widget:

php artisan make:filament-widget StatsOverview

Edit app/Filament/Widgets/StatsOverview.php:

protected function getStats(): array
{
    return [
        Stat::make('Total Products', Product::count()),
        Stat::make('Latest Product', Product::latest()->first()?->name),
    ];
}

Now, it appears on your dashboard!


Bonus: Adding User Permissions

Want to restrict access? Update app/Models/User.php:

use Filament\Models\Contracts\FilamentUser;

class User extends Authenticatable implements FilamentUser
{
    public function canAccessPanel(Panel $panel): bool
    {
        return $this->is_admin; // Only admins can access
    }
}

Final Thoughts

🎉 Congratulations! You’ve built a fully functional admin panel with:
Product management
A custom dashboard
User access control

Next Steps?

🔹 Explore Filament’s official docs
🔹 Try adding image uploads or user roles
🔹 Deploy your panel to a live server


Enjoyed this guide? Share it with fellow developers! 🚀

Got questions? Drop them in the comments below! 👇

Tags

Laravel Admin Panel Php

Comments

No comments yet. Be the first to comment!

Please log in to post a comment:

Continue with Google

Related Posts