Private package repository for liauwmedia ecosystem
Core admin package for Liauwmedia ecosystem with package discovery and management
A comprehensive Laravel admin panel package with RBAC, modules system, package management, and multi-language support.
Add the Liauwmedia Package Registry to your composer.json:
{
"repositories": [
{
"type": "composer",
"url": "https://packages.liauw-media.com"
},
{
"type": "vcs",
"url": "https://gitlab.liauw-media.de/liauwmedia/admin.git"
}
]
}
For local development, use path repository instead:
{
"repositories": [
{
"type": "path",
"url": "./packages/liauwmedia-admin"
}
]
}
# For local development (will show as dev-main)
composer require liauwmedia/admin:@dev
# Note: Path repositories always show as 'dev-main' in composer.lock
# See INSTALLATION.md for versioning options
IMPORTANT: These packages MUST be installed before running admin:install:
# Install Spatie Permission (REQUIRED for RBAC)
composer require spatie/laravel-permission
# Install Laravel Fortify (Optional but recommended for authentication)
composer require laravel/fortify
If Spatie Permission is not installed, the installation will fail.
# Interactive installation (recommended)
php artisan admin:install
# Or specify options
php artisan admin:install --route-prefix=dashboard
# Non-interactive with defaults
php artisan admin:install --non-interactive
This command will:
routes/admin.php with your chosen prefixIf you didn't run migrations during installation:
# Run migrations
php artisan migrate
# Setup default data (roles, permissions, translations)
php artisan admin:setup
Ensure your User model has the admin trait:
<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Liauwmedia\Admin\Traits\HasAdminRoles;
class User extends Authenticatable
{
use HasAdminRoles;
// ... rest of your model
}
If you didn't create an admin user during setup:
// In tinker or a seeder
$user = User::create([
'name' => 'Admin',
'email' => 'admin@example.com',
'password' => bcrypt('password'),
]);
$user->assignRole('super-admin');
The admin panel configuration is stored in config/admin.php. The route prefix you chose during installation is hardcoded in:
routes/admin.php - The actual route definitionsconfig/admin.php - For reference by other packagesNo environment variables are needed for the route prefix as it's embedded directly in the files during installation.
config/admin.php - Main admin configurationconfig/fortify.php - Authentication configuration (if using Fortify)config/permission.php - Spatie Permission configurationAfter installation, access your admin panel at:
http://your-domain.com/wp-admin
(Or whatever route prefix you configured)
The package creates three default roles:
super-admin - Full system accessadmin - Administrative accesseditor - Content editing access# Install the package
php artisan admin:install
# Setup default data (run after migrations)
php artisan admin:setup
# Update the package (preserves customizations)
php artisan admin:update
# Uninstall the package and clean up
php artisan admin:uninstall
# Configure Fortify integration only
php artisan admin:install --fortify-only
# Discover and register modules
php artisan admin:discover-modules
# List all installed packages
php artisan admin:packages
# List packages by category
php artisan admin:packages --category=seo
# Output as JSON
php artisan admin:packages --json
# Clear package discovery cache
php artisan admin:packages --clear-cache
The admin package provides comprehensive package management with registry integration.
Access the packages dashboard at /{route-prefix}/packages:
Features:
use Liauwmedia\Admin\Services\PackageDiscoveryService;
$discovery = app(PackageDiscoveryService::class);
// Get installed packages
$installed = $discovery->discoverPackages();
// Get available packages from registry
$available = $discovery->discoverAvailablePackages();
// Get all packages (installed + available) with installation status
$all = $discovery->discoverAllPackages();
// Check if package is installed
$isInstalled = $discovery->isInstalled('liauwmedia/tracking');
// Get specific package
$package = $discovery->getPackage('liauwmedia/tracking');
// Get packages by category
$seoPackages = $discovery->getPackagesByCategory('seo');
// Get statistics
$stats = $discovery->getStatistics();
// ['total_packages', 'with_service_providers', 'total_dependencies', 'categories']
// Clear cache
$discovery->clearCache();
GET /{route-prefix}/packages # List all packages
GET /{route-prefix}/packages/json # JSON endpoint
GET /{route-prefix}/packages/{name} # Package details
GET /{route-prefix}/packages/category/{category} # Filter by category
GET /{route-prefix}/packages/statistics # Package statistics
POST /{route-prefix}/packages/cache/clear # Clear cache
Configure package discovery in config/admin.php:
'package_discovery' => [
'vendor' => 'liauwmedia',
'registry_url' => env('LIAUWMEDIA_REGISTRY_URL', 'https://packages.liauw-media.com'),
'cache_enabled' => true,
'cache_ttl' => 3600, // 1 hour
'categories' => [
'tracking' => ['tracking', 'analytics', 'pixel'],
'seo' => ['seo', 'sitemap', 'meta'],
// ... more categories
],
],
The admin package supports a modular architecture. Modules can be installed as separate packages.
Create a service provider that implements the module interface:
namespace YourVendor\YourModule;
use Liauwmedia\Admin\Contracts\ModuleInterface;
class YourModuleServiceProvider extends ServiceProvider implements ModuleInterface
{
public function getModuleConfig(): array
{
return [
'name' => 'your-module',
'display_name' => 'Your Module',
'description' => 'Module description',
'version' => '1.0.0',
'routes' => __DIR__ . '/../routes/admin.php',
'views' => __DIR__ . '/../resources/views',
'migrations' => __DIR__ . '/../database/migrations',
];
}
}
If you encounter errors that prevent artisan commands from running (like duplicate route includes):
# Run the emergency repair script directly
php vendor/liauwmedia/admin/emergency-repair.php
# Then clear caches
php artisan config:clear
php artisan route:clear
This script can fix:
If you're upgrading from an older version or experiencing migration issues, the install command will automatically clean up old migrations. You can also manually remove them:
# Remove old admin_translations migrations
rm database/migrations/*admin_translations*.php
# If the table exists, drop it
php artisan tinker
>>> Schema::dropIfExists('admin_translations');
This error occurs if you have an old version. The package no longer uses admin_translations table. Solution:
php artisan migrate
php artisan admin:setup
Ensure proper file permissions:
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
If you see authentication errors:
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
Then configure config/fortify.php and add FortifyServiceProvider to config/app.php.
The package includes smart update handling:
# Update all package files (will prompt before overwriting customizations)
php artisan admin:update
# Force update all files
php artisan admin:update --force
# Update only configuration files
php artisan admin:update --config-only
# Update only migrations
php artisan admin:update --migrations-only
The update command:
To cleanly remove the package:
# Remove package files and data (with confirmations)
php artisan admin:uninstall
# Force removal without prompts
php artisan admin:uninstall --force
# Keep database data
php artisan admin:uninstall --keep-data
# Keep configuration files
php artisan admin:uninstall --keep-config
# Then remove from composer
composer remove liauwmedia/admin
The uninstall command:
The package creates a .admin-manifest.json file to track:
This allows for smart updates and clean removals.
MIT License