Download the PHP package basekit-laravel/basekit-laravel-media without Composer
On this page you can find all versions of the php package basekit-laravel/basekit-laravel-media. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download basekit-laravel/basekit-laravel-media
More information about basekit-laravel/basekit-laravel-media
Files in basekit-laravel/basekit-laravel-media
Package basekit-laravel-media
Short Description Media library for Laravel: metadata for files on a filesystem disk, a folder hierarchy and a Filament admin screen.
License MIT
Homepage https://github.com/basekit-laravel/basekit-laravel-media
Informations about the package basekit-laravel-media
Basekit Laravel Media
Media library for Laravel: files on a Laravel filesystem disk, their metadata in the database, a folder hierarchy for editors, and a Filament admin screen.
Moving a file between folders changes metadata only, so published URLs never break.
๐ Contents
- Requirements
- Installation
- Configuration
- The admin screen
- Permissions
- Uploads
- Deleting and restoring
- Using media from your own code
- Custom views and translations
- Security
- Limitations
- Development
๐งฐ Requirements
- PHP 8.4 or 8.5
- Laravel 13
- Filament 5 (optional โ only the admin screen needs it)
โฌ๏ธ Installation
Package discovery registers the service provider and runs the migration. Publish it only if you want to own the file:
The admin screen needs Filament:
The screen's stylesheet ships as a Filament asset, so publishing the assets is what puts it on the panel. Run this again after every upgrade:
โ๏ธ Configuration
Everything lives in config/basekit-laravel-media.php:
Use a public disk so stored files get a web URL. A page stores that URL, so keep the disk alive for as long as pages refer to files on it.
soft_deletes belongs in this file rather than in .env: it decides what deleting means for rows already in the table, so it should not flip with a deploy.
๐ฅ๏ธ The admin screen
Register the plugin on a panel:
The plugin adds a single Media screen that holds the folders and the files together.
๐ Permissions
By default anyone who can reach the panel can use the media screen โ installing the package does not lock an existing panel out of its own library.
To restrict an ability, define a gate and point the ability at it:
The same thing through .env is BASEKIT_MEDIA_VIEW_PERMISSION=manage-media. A null name โ the default โ allows the ability without asking.
| Ability | Covers |
|---|---|
view |
Opening the Media screen. |
create |
Upload and New folder. |
update |
Edit, Move, and dragging a file onto a folder. |
delete |
Delete on a file or a folder. |
If your application already has a policy on Media or MediaFolder, that policy is asked first and is about the individual row โ you do not need to define these gate names as well.
โฌ๏ธ Uploads
Set uploads.max_size in kilobytes (null falls back to Filament's 12 MB) and uploads.accepted_file_types. Filament checks both what the browser sends and what actually arrives, so a file outside the limits is refused rather than written.
A file is stored at path/folder-slug, under the folder that is open when it is uploaded.
๐๏ธ Deleting and restoring
Turning soft deletes off
An application that must not keep user-supplied files after a removal can have every deletion take the row and the file together:
With it off, delete() is a hard delete and there is nothing for restore() to bring back; the confirmation an editor reads says so.
- The
deleted_atcolumn is created either way, so changing the setting needs no migration. - Folders are always deleted for good, in both modes. Their files fall back to All files.
๐ป Using media from your own code
findByStorageValue() matches a stored web URL or path back to its row.
๐จ Custom views and translations
They land in resources/views/vendor/basekit-laravel-media and lang/vendor/basekit-laravel-media. The views render standalone and never assume your application's layout.
The stylesheets are not part of that: they are registered as Filament assets from resources/css/dist/, so a published view carries no CSS of its own.
Class names follow BEM with bkm as the package prefix: bkm-tile, bkm-tile__preview, bkm-folder--over. bkm on its own is the prefix, never a block.
๐ง Limitations
The package does not convert, resize or process files, and it does not read image dimensions.
It does not provide:
- image, video or PDF previews beyond the stored URL
- tagging, favouriting or search beyond the file name
- per-application tenancy of the library
๐งช Development
๐ License
Basekit Laravel Media is open-source software licensed under the MIT License.
All versions of basekit-laravel-media with dependencies
illuminate/contracts Version ^13
illuminate/database Version ^13
illuminate/filesystem Version ^13
illuminate/support Version ^13