Skip to content

saifulcoder/filament-starter

Repository files navigation

Filament Logo

Filament v4 Laravel 12 PHP 8.2+ License

Filament Starter Kit

A modern, production-ready starter kit built with FilamentPHP v4, Laravel 12, and essential packages for building robust admin panels. This starter comes pre-configured with role-based access control and dynamic menu management.

✨ Features

  • 🎨 FilamentPHP v4 - The latest version of the elegant admin panel framework
  • 🔐 Filament Shield - Complete role and permission management with auto-discovery
  • 📋 Menu Management - Dynamic navigation builder with role-based visibility
  • 🛡️ Spatie Permission - Robust role and permission handling
  • Laravel 12 - Latest Laravel framework with modern PHP 8.2+ features
  • 🎯 Production Ready - Pre-configured and optimized for deployment

📦 Included Packages

Package Version Description
filament/filament ^4.0 Admin panel framework
bezhansalleh/filament-shield ^4.0 Role & permission management
spatie/laravel-permission ^6.0 Backend for roles & permissions

🚀 Installation

Requirements

  • PHP >= 8.2
  • Composer
  • Node.js & NPM
  • MySQL / PostgreSQL / SQLite

Quick Start

  1. Clone the repository

    git clone https://github.com/saifulcoder/filament-starter.git
    cd filament-starter
  2. Run Setup Script

    composer setup

    This will:

    • Install Composer dependencies
    • Copy .env.example to .env
    • Generate application key
    • Run database migrations
    • Install NPM dependencies
    • Build assets
  3. Configure your database in .env:

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=filament_starter
    DB_USERNAME=root
    DB_PASSWORD=
  4. Setup Filament Shield (Roles & Permissions):

    php artisan shield:setup
    php artisan shield:generate --all
    php artisan shield:super-admin
  5. Access the Admin Panel

    Visit: http://your-domain/admin

🛠️ Development

Start the development server with all essential services:

composer dev

This command runs concurrently:

  • 🌐 Laravel development server
  • 📬 Queue listener
  • 📝 Laravel Pail (log viewer)
  • ⚡ Vite development server

📚 Menu Management

The starter includes a complete Navigation Management system that allows you to:

  • ✅ Create multiple navigation menus
  • ✅ Add menu items with labels and URLs
  • ✅ Configure link targets (same tab / new tab)
  • ✅ Set role-based visibility for each menu item
  • ✅ Create nested sub-menus
  • ✅ Reorder items with drag & drop

Usage Example

use App\Models\Navigation;

// Get navigation by handle
$mainMenu = Navigation::where('handle', 'main-menu')->first();

// Access menu items
foreach ($mainMenu->items as $item) {
    echo $item['label'];
    echo $item['url'];
}

🔐 Filament Shield

Shield provides automatic permission discovery and generation for all Filament resources:

Generate Permissions

# Generate permissions for all resources
php artisan shield:generate --all

# Generate for specific resource
php artisan shield:generate --resource=UserResource

Create Super Admin

php artisan shield:super-admin

📁 Project Structure

├── app/
│   ├── Filament/
│   │   └── Resources/
│   │       └── NavigationResource.php    # Menu management
│   ├── Models/
│   │   ├── Navigation.php                # Navigation model
│   │   └── User.php                      # User with HasRoles trait
│   ├── Policies/
│   └── Providers/
├── config/
│   ├── filament.php                      # Filament configuration
│   ├── filament-shield.php               # Shield configuration
│   └── permission.php                    # Spatie Permission config
├── database/
│   └── migrations/
│       ├── create_permission_tables.php  # Spatie permissions
│       └── create_navigations_table.php  # Menu management
└── resources/

⚙️ Configuration

Filament Shield

Configure Shield settings in config/filament-shield.php:

return [
    'super_admin' => [
        'enabled' => true,
        'name' => 'super_admin',
    ],
    // ...
];

Adding New Resources

When you create a new Filament resource, generate its permissions:

php artisan make:filament-resource Post
php artisan shield:generate --resource=PostResource

🧪 Testing

Run tests with:

composer test

📜 Available Scripts

Command Description
composer setup Complete project setup
composer dev Start development servers
composer test Run tests

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is open-sourced software licensed under the MIT license.

Contributing

This project helps you and you want to help keep it going? Buy me a coffee:
Buy Me A Coffee
or via
https://saweria.co/saifulcoder


Made with ❤️ using FilamentPHP and Laravel

About

filament v4 filament-shield, menu management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages