Appearance
Installation
Media Library Pro is a paid package served from a private Composer repository. Your purchase email holds a licence key; your username is the email you bought with.
Add the repository
bash
composer config repositories.media-library composer https://packages.hoceine.comAdd your licence
bash
composer config http-basic.packages.hoceine.com you@example.com YOUR-LICENCE-KEYThis writes to the project's auth.json. Keep that file out of git, or add --global to store the credentials once for every project on your machine.
Require the package
bash
composer require hoceineel/filament-media-library-proRun the installer
bash
php artisan media-library:installThe installer does five things:
- Publishes
config/filament-media-library.php. - Publishes Spatie's
config/media-library.phpif you do not have one yet. - Publishes Spatie's
create_media_tablemigration if your app has none yet. - Asks
Run the migrations now?and runsphp artisan migrateif you accept. The library's own tables load from the package, so they are migrated with the rest. - Runs
storage:linkwhen apublicdisk exists andpublic/storagedoes not.
It finishes by printing the next steps. Pass --force to overwrite a config file you published earlier. In a script, add --no-interaction so the migration prompt takes its default and does not wait for input.
Custom key types
If your users or tenants use UUID or ULID keys, set key_types in the published config before you migrate. Answer no to the migration prompt, edit the config, then run php artisan migrate.
Register the plugin
Add the plugin to your panel provider:
php
use Hoceineel\FilamentMediaLibrary\FilamentMediaLibraryPlugin;
use Filament\Panel;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(
FilamentMediaLibraryPlugin::make()
->navigationGroup('Content')
->navigationCountBadge()
);
}This adds the Media library page to the panel at /media-library under your panel path. If the panel uses Filament tenancy, the library scopes itself to the current tenant with no extra call. For stancl/tenancy or your own tenant lookup, add ->tenancy() and ->resolveTenantUsing(). See Tenancy and the plugin reference.
Publish the assets
bash
php artisan filament:assetsRun this again after every update.
Run a queue worker
Thumbnails are generated while the upload request runs, so new files appear at once. Larger conversions, such as the preview size, are queued. Keep a worker running:
bash
php artisan queue:workSchedule the cleanup
In routes/console.php:
php
use Illuminate\Support\Facades\Schedule;
Schedule::command('media-library:prune')->daily();The command deletes trash older than 30 days and abandoned upload chunks. See Commands.
Check it works
- Open the panel and click Media library in the navigation.
- Drop an image onto the page. It should upload and open in the details panel.
- Run
php artisan route:list --name=media-libraryand confirm the upload routes are listed.
If a thumbnail stays blank, check that the queue worker is running and that storage:link has been run. For more, see Troubleshooting. To build your first form field, continue with the Quick Start.
Deploying
Servers and CI need the same credentials. Either commit nothing and set them per environment:
bash
composer config --global http-basic.packages.hoceine.com you@example.com YOUR-LICENCE-KEYor provide them as JSON in the COMPOSER_AUTH environment variable:
bash
COMPOSER_AUTH='{"http-basic":{"packages.hoceine.com":{"username":"you@example.com","password":"YOUR-LICENCE-KEY"}}}'On Laravel Forge, add them in the server's or site's Composer package authentication settings. After each deploy, run php artisan migrate --force and php artisan filament:assets, and restart your queue workers.
Updates
Your licence includes updates for its update window. Releases published after the window ends stay hidden until you renew; versions you already have keep installing.
Publishing files
bash
php artisan vendor:publish --tag=filament-media-library-config
php artisan vendor:publish --tag=filament-media-library-translations
php artisan vendor:publish --tag=filament-media-library-viewsEnglish and Arabic ship in the box. See Translations.