定制 shamseer1997/laravel-file-viewer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shamseer1997/laravel-file-viewer

最新稳定版本:v1.0.2

Composer 安装命令:

composer require shamseer1997/laravel-file-viewer

包简介

A basic file viewer for Laravel projects

README 文档

README

Latest Version on Packagist Total Downloads GitHub GitHub Stars

Laravel File Viewer

Laravel File Viewer is the easiest way to preview images, videos, audio, PDF, DOCX, PPTX, XLSX, and more in your Laravel app. Instantly add beautiful file previews to your admin panels, dashboards, or user portals.

✨ Loved by developers. Easy to install. Works out of the box.

🚦 Features

  • 📄 Preview images, videos, audio, PDF, DOCX, PPTX, XLSX, and more
  • ⚡️ Super simple integration—just one line in your controller!
  • 🎨 Customizable UI (publish and tweak the views)
  • 🛡️ Secure: works with Laravel's storage disks
  • 🌍 Multilingual ready

🛠️ Installation

Install via Composer:

composer require shamseer1997/laravel-file-viewer

Publish assets:

php artisan vendor:publish --provider="shamseer1997\LaravelFileViewer\LaravelFileViewerServiceProvider" --tag=assets

Publish views (optional, for UI customization):

php artisan vendor:publish --provider="shamseer1997\LaravelFileViewer\LaravelFileViewerServiceProvider" --tag=views

🚀 Quick Start

Add the alias in your config/app.php (Laravel 10 and below):

'aliases' => Facade::defaultAliases()->merge([
    'LaravelFileViewer' => shamseer1997\LaravelFileViewer\LaravelFileViewerFacade::class,
])->toArray(),

Example Controller

use Illuminate\Http\Request;
use shamseer1997\LaravelFileViewer\LaravelFileViewer;

class FilePreviewController extends Controller
{
    public function filePreview($fileName){
        $filePath = $fileName;
        $disk = 'public';
        $fileUrl = asset('storage/' . $fileName);
        $fileData = [
            [
                'label' => __('Label'),
                'value' => "Value"
            ]
        ];
        return LaravelFileViewer::show($fileName, $filePath, $fileUrl, $disk, $fileData);
    }
}

Add a route in routes/web.php:

Route::get('/file-preview/{fileName}', [FilePreviewController::class, 'filePreview']);

🌟 Why Laravel File Viewer?

  • Save hours: No need to integrate multiple JS libraries yourself.
  • Modern UI: Looks great out of the box.
  • Flexible: Works with any Laravel storage disk.
  • Trusted: Used in production by agencies and startups.

📈 Help Us Grow!

If you find this package useful:

  • ⭐ Star this repo on GitHub
  • 📦 Try it in your next Laravel project
  • 💬 Share feedback and suggestions

📋 Changelog

See CHANGELOG for recent updates.

🤝 Contributing

PRs are welcome! See CONTRIBUTING for details. Questions? Email hsvirus2015@gmail.com or open an issue.

🔒 Security

If you discover any security issues, please email hsvirus2015@gmail.com instead of using the issue tracker.

👏 Credits

📄 License

MIT. See License File for details.

🎬 Demo

AwesomeScreenshot-1_2_2023.1.32.27PM.mp4

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 28
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-24