mlbrgn/laravel-medialibrary-extensions
最新稳定版本:2.1.10
Composer 安装命令:
composer require mlbrgn/laravel-medialibrary-extensions
包简介
Extensions designed for use with the Media Library package by Spatie. Adds a single image uploader, multiple image uploader and a modal with carousel
关键字:
README 文档
README
This package adds functionality toMedia Library package by Spatie:
- Providing a view to upload multiple media
- Providing a view to upload single media
Requirements
This package assumes that spatie/laravel-medialibrary is installed and its default migration has been run to create the media table.
for the image editor to work the NPM package "@mlbrgn/media-library-extensions" needs to be installed.
Install
- Install the laravel package:
composer require mlbrgn/laravel-medialibrary-extensions
- Run install command
php artisan media-library-extensions:install
- add @import "media-library-extensions" to your app.js (or similar)
import {ImageEditor} from '@mlbrgn/media-library-extensions'
you can optionally set the path to the translations you want to use, but make sure the translations live in the path you specified.
NOTE: Don't forget to run "npm run build" for the image editor to be built!
ImageEditor.translationsPath = '/js/vendor/image-editor/lang';
The install command will publish assets, config, translation, views, and a policy. Also it will install the required @mlbrgn/media-library-extensions package
Manual install (without the install command)
You can also manually install by installing the @mlbrgn/media-library-extensions package
npm install @mlbrgn/media-library-extensions
And publish the required assets
php artisan vendor:publish --provider="Mlbrgn\MediaLibraryExtensions\Providers\MediaLibraryExtensionsServiceProvider" --tag="assets"
add @import for "media-library-extensions" to your app.js (or similar)
import {ImageEditor} from '@mlbrgn/media-library-extensions'
you can optionally set the path to the translations you want to use, but make sure the translations live in the path you specified.
NOTE: Don't forget to run "npm run build" for the imageeditor to be built!
ImageEditor.translationsPath = '/js/vendor/image-editor/lang';
Theme
The default themes are:
- plain
- bootstrap-5
Publishing
Several assets can be published:
- config
- views
- assets
- policy
- translations
to publish all assets:
php artisan vendor:publish --provider="Mlbrgn\MediaLibraryExtensions\Providers\MediaLibraryExtensionsServiceProvider" --tag="media-library-extensions-config"
to publish a single tag (group of assets):
php artisan vendor:publish --provider="Mlbrgn\MediaLibraryExtensions\Providers\MediaLibraryExtensionsServiceProvider" --tag="config"
Icons
For icons to work, you will have to install a Blade UIKit/Blade-icons package.
The package is configured to use Bootstrap icons by default. To display them properly install
composer require davidhsianturi/blade-bootstrap-icons
You can override the icons in the published configuration file of this package and install another Blade UIKit/Blade-icons package
php artisan vendor:publish --tag=media-library-extensions-config php artisan vendor:publish --tag=media-library-extensions-views php artisan vendor:publish --tag=media-library-extensions-assets php artisan vendor:publish --tag=media-library-extensions-policy php artisan vendor:publish --tag=media-library-extensions-translations
Testing
This package uses Pest PHP for testing. For more information on how to write tests for this package, see the TESTING.md guide.
统计信息
- 总下载量: 444
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-08