livewire-filemanager/filemanager
Composer 安装命令:
composer require livewire-filemanager/filemanager
包简介
A simple, friendly and practical Livewire filemanager for your applications
README 文档
README
Livewire Filemanager
A simple, friendly, and practical file manager designed specifically for Laravel applications. This Livewire-powered tool makes it easy to manage files and folders within your project, offering an intuitive interface and seamless integration with Laravel's ecosystem. Perfect for developers seeking an efficient and user-friendly solution for file and folders management.
- Drag & drop files
- Search for files or folders
- Ready to include in any projects
- Multiple languages (see resources/lang for the list)
- Darkmode available
- API endpoints
Watch the presentation of the package here: Laravel Switzerland Meetup
Full Documentation - Comprehensive guide with detailed examples, API reference, and advanced usage.
Project requirements
- PHP 8.2.0 or greater required
Important composer dependencies
Installation
Important
This package is still in development and its structure can change until a stable version is released. Use with caution in you projects. Additionally, the file manager does not include any security layers to protect uploaded documents. You are responsible for controlling access where you install the package and securing your files and folders.
You can install the package via composer:
composer require livewire-filemanager/filemanager
Publish the package's migration file:
php artisan vendor:publish --tag=livewire-filemanager-migrations
This package relies on spatie/medialibrary to handle the medias, so if you haven't already configured the package, don't forget this step:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"
If you need for informations about the spatie/medialibrary package, please visit their documentation
Note
Thumbnails When you upload images, the package will generate a thumbnail. By defaults, it will be dispatched into the queues. You'll have to launch the workers inside your app or change the QUEUE_CONNECTION value in your .env file
After that, you need to run migrations.
php artisan migrate
This will create a folders table which will hold all the filemanager structure and a media table if not already present.
Package configuration
Next, you'll need to use the <x-livewire-filemanager /> component where you want to place the filemanager.
For the styles and scripts, the package relies on TailwindCSS and AlpineJS. So if you don't already have them installed, you can include the @filemanagerScripts and @filemanagerStyles.
<!DOCTYPE html> <html> <head> @filemanagerStyles </head> <body> <x-livewire-filemanager /> @filemanagerScripts </body> </html>
Important
The @filemanagerStyles will include the PLAY CDN from TailwindCSS which is not recommended for production. Instead, prefer including the path inside your tailwind config file.
Tailwind version 4, in your app.css
@source '../../vendor/livewire-filemanager/filemanager/resources/views/**/*.blade.php';
Tailwind version 3, in your tailwind.config.js
module.exports = { content: [ './resources/**/*.blade.php', './vendor/livewire-filemanager/filemanager/resources/views/**/*.blade.php', ], }
If you intend to give access to your files with the public, you can add this inside your web routes file:.
Route::get('{path}', [FileController::class, 'show'])->where('path', '.*')->name('assets.show');
And don't forget to import the FileController class:
use LivewireFilemanager\Filemanager\Http\Controllers\Files\FileController;
This will give you an endpoint where you can reach the files with a direct url.
Inside the filemanager, when you click on a file, you'll have the possibility to copy the url to the file. In order to work correctly, this feature needs to have your domain with https enabled.
The interface
Once everything is installed, the interface should look like this:
The whole interface is available in dark/light mode.
ACL Configuration
If you want to enable ACL, you should publish the config file:
php artisan vendor:publish --tag=livewire-filemanager-config
This will create a livewire-filemanager.php file inside your config folder. You can now enable the ACL by changing the acl_enabled value to true.
Also publish the Spatie medialibrary config file, if you haven't already done it.
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-config"
In the media-library config file, change the media_model value to LivewireFilemanager\Filemanager\Models\Media. If you already have a media model, you can use the Trait LivewireFilemanager\Filemanager\Traits\HasMediaOwner inside your model.
This will ensure that only users who created files can view them.
API Integration
The package includes a comprehensive REST API for programmatic file and folder management. The API provides endpoints for:
- Folder CRUD operations (create, read, update, delete)
- File upload and management
- Bulk file operations
- Authentication and authorization support
API endpoints are available under the /api/filemanager/v1/ prefix and require authentication via Laravel Sanctum. The API can be enabled/disabled and configured through the package configuration file. If upgrading the package, you may update the config file as well inside your project.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
All contributions are welcome and will be fully credited.
Please see CONTRIBUTING for details.
Credits
- Yves Engetschwiler
- All illustrations are made by Quetzal Graphic Design
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
livewire-filemanager/filemanager 适用场景与选型建议
livewire-filemanager/filemanager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.69k 次下载、GitHub Stars 达 361, 最近一次更新时间为 2024 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「filemanager」 「livewire-filemanager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 livewire-filemanager/filemanager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 livewire-filemanager/filemanager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 livewire-filemanager/filemanager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Simple, fast, standalone PHP lib, that helps You to define, if any of your files were modified since last time You check - Is this file FRESH?
Effortless file management with Symfony UX and Mezcalito UX FileManager
File Manager for Yii2
A file upload/editor intended for use with Laravel 5 and CKEditor
A file upload/editor intended for use with Laravel 5 to 6 and CKEditor / TinyMCE
统计信息
- 总下载量: 9.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 362
- 点击次数: 9
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-11