phpinnacle / pinax
Polymorphic media management for Laravel Filament applications.
Requires
- php: ^8.4
- filament/filament: ^4.0|^5.0
- spatie/laravel-package-tools: ^1.92
Requires (Dev)
- pestphp/pest: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-06 22:58:25 UTC
README
Pinax is a media library for Filament applications. It stores uploaded file metadata in a polymorphic media table and provides gallery, upload and infolist components with folders, ordering and semantic marks.
Features
- Polymorphic media attachments for any Eloquent model.
- Configurable filesystem disk, base directory and database connection.
MediaUploadfor a single upload workflow.MediaGalleryfor multiple ordered files.- Named
Markvalues such as cover, primary or featured, including unique/default behavior. MediaEntryfor image display in Filament schemas.- Optional tenancy and policy-backed media management.
Installation
composer require phpinnacle/pinax
php artisan vendor:publish --tag="phpinnacle-pinax-migrations"
php artisan migrate
For the default public disk, ensure its storage link exists:
php artisan storage:link
Register PinaxPlugin::make() in the Filament panel. Publish phpinnacle-pinax-config to change upload.disk, upload.folder, connection or tenancy.
Gallery usage
use PHPinnacle\Pinax\Forms\MediaGallery; use PHPinnacle\Pinax\Mark; MediaGallery::make('gallery') ->disk('public') ->directory('products') ->marks( Mark::make('cover')->label('Cover')->unique()->default(), Mark::make('featured')->label('Featured'), );
The Media model also exposes fetch(), store(), clear(), one(), single() and folder() for application-level access. Public URLs require a disk capable of generating accessible URLs.
Uploads stream from the temporary disk to the configured destination with the field's visibility. moveFiles() removes the temporary source only after a successful write, including when the disks differ. A failed transfer returns no stored value and creates no successful media metadata. Storage exceptions propagate according to the disk configuration.
MediaUpload returns the saved media ID; the gallery upload returns the destination path. MIME type and size are read from the stored destination, so metadata remains available after moving the temporary file. Media::store() expects the supplied destination disk/path to contain the uploaded file.
Testing
composer test
Changelog and license
See CHANGELOG. Released under the MIT License.