zoker / filament-multisite
Multisite plugin for laravel with Filament managing
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/zoker/filament-multisite
Requires
- php: ^8.4
- filament/filament: ^3.3
- filament/spatie-laravel-translatable-plugin: ^3.3
- laravel/framework: ^12.0
- spatie/laravel-package-tools: ^1.92
Requires (Dev)
- orchestra/testbench: ^10.6
This package is auto-updated.
Last update: 2025-10-30 16:18:40 UTC
README
A powerful package for managing multiple sites within a single Laravel Filament application. This package provides tools for handling site-specific routes, translations, and configurations.
Features
- Multi-site route management
- Built-in localization support
- Multisite link generation
- Site management
- Filament integration
Installation
- Install the package via Composer:
composer require zoker/filament-multisite
- Publish and run migrations:
php artisan vendor:publish --tag=filament-multisite-migrations php artisan migrate
- Add to your Filament panel configuration:
use Zoker\FilamentMultisite\Multisite; // In your Filament panel configuration ->plugin(Multisite::make())
Usage
Defining Routes
Create site-specific routes in routes/web.php:
use Illuminate\Support\Facades\Route; Route::multisite(function () { // These routes will be available for all sites Route::get('/', [HomeController::class, 'index']); // Add more site-specific routes here });
Translatable Routes
For localized routes, use the translatable method. Translation keys should be placed in your application's resources/lang directory.
Route::translatable(function () { Route::get(__('routes.about'), [AboutController::class, 'index'])->name('about'); });
Generating URLs
Use the multisite_route() helper to generate URLs that respect the current site context:
// Basic usage $url = multisite_route('home'); // With parameters $url = multisite_route('products.show', ['product' => $product]); // Absolute URLs $url = multisite_route('login', [], true);
Managing the Current Site
Using the Facade
use Zoker\FilamentMultisite\Facades\SiteManager; // Get current site $currentSite = SiteManager::getCurrentSite(); // Set a current site by ID SiteManager::setCurrentSiteById(1); // Set a current site by request SiteManager::setCurrentSiteByRequest($request);
Using the Helper
// Get current site $site = currentSite();
Middleware
The package includes middleware to automatically set the current site based on the request:
// In your route group Route::middleware([\Zoker\FilamentMultisite\MultisiteMiddleware::class])->group(function () { // Your routes here });
or add the middleware to the web middleware group:
Events
The package dispatches events that you can listen for:
Zoker\FilamentMultisite\Events\SiteChanged: Dispatched when the active site changes
Testing
Run the tests with:
composer test