PHPackages                             vish4395/laravel-file-viewer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. vish4395/laravel-file-viewer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

vish4395/laravel-file-viewer
============================

A basic file viewer for Laravel projects

2.0.0(1mo ago)17733.1k↓20.8%28MITJavaScriptPHP ^8.2

Since Jan 3Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/vish4395/laravel-file-viewer)[ Packagist](https://packagist.org/packages/vish4395/laravel-file-viewer)[ Docs](https://github.com/vish4395/laravel-file-viewer)[ RSS](/packages/vish4395-laravel-file-viewer/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (7)Versions (12)Used By (0)

🖼️ Laravel File Viewer
======================

[](#️-laravel-file-viewer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7a6c167580777d64413e3330a256fe7abeadc263e425acd888cddc0afd0b151a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76697368343339352f6c61726176656c2d66696c652d7669657765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vish4395/laravel-file-viewer)[![Total Downloads](https://camo.githubusercontent.com/8be2f1af0a1f3ae00b7999dae5d423a381ec550fe6288b55c180fdb8d2d8dfa9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76697368343339352f6c61726176656c2d66696c652d7669657765722e7376673f7374796c653d666c61742d73717561726526636f6c6f723d627269676874677265656e)](https://packagist.org/packages/vish4395/laravel-file-viewer)[![GitHub](https://camo.githubusercontent.com/35e6c077b38562b0b4189a07378dffe6b00b231802299d68fda86c6614b49f1b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f76697368343339352f6c61726176656c2d66696c652d7669657765723f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/35e6c077b38562b0b4189a07378dffe6b00b231802299d68fda86c6614b49f1b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f76697368343339352f6c61726176656c2d66696c652d7669657765723f7374796c653d666c61742d737175617265)[![GitHub Stars](https://camo.githubusercontent.com/a1ef4b887c7c6b4e58e12d338325277b6fd89c2751981a3df7ea2b3146746ec8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f76697368343339352f6c61726176656c2d66696c652d7669657765723f7374796c653d666c61742d737175617265)](https://github.com/vish4395/laravel-file-viewer/stargazers)[![Twitter URL](https://camo.githubusercontent.com/bb721d10fbf2eb55123ca3479b4c4a7deb212c6a15280a6266841a594cf29dde/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c3f636f6c6f723d626c7565266c6f676f3d74776974746572267374796c653d666c61742d7371756172652675726c3d68747470732533412532462532466769746875622e636f6d25324676697368343339352532466c61726176656c2d66696c652d766965776572253246)](https://twitter.com/intent/tweet?text=Checkout%20this%20awesome%20package%0Ahttps%3A//github.com/vish4395/laravel-file-viewer/)

[![Laravel File Viewer](laravel-file-viewer.png)](laravel-file-viewer.png)

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

---

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

---

🚦 Features
----------

[](#-features)

- 📄 Preview images, videos, audio, PDF, DOCX, PPTX, XLSX, CSV, plain text, JSON, and archives
- ⚡️ Super simple integration — one method call in your controller
- 🎨 Customizable UI — publish and tweak the views
- 🛡️ Secure: validates file existence via Laravel's storage disks; DOCX frame route uses signed URLs
- 🔧 Configurable toolbar (download, open in new tab, copy link, fullscreen)
- 🌍 Multilingual ready
- 🔌 Auto-discovered — no manual registration required in Laravel 11+

---

📋 Requirements
--------------

[](#-requirements)

- PHP 8.2+
- Laravel 11, 12, or 13

---

🛠️ Installation
---------------

[](#️-installation)

Install via Composer:

```
composer require vish4395/laravel-file-viewer
```

Publish the assets (required):

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

Publish the config (optional):

```
php artisan vendor:publish --provider="Vish4395\LaravelFileViewer\LaravelFileViewerServiceProvider" --tag=config
```

Publish views for UI customization (optional):

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

---

🚀 Quick Start
-------------

[](#-quick-start)

The package is auto-discovered in Laravel 11+. No manual provider or alias registration needed.

### Example Controller

[](#example-controller)

```
use Vish4395\LaravelFileViewer\LaravelFileViewer;

class FilePreviewController extends Controller
{
    public function show(string $fileName)
    {
        return LaravelFileViewer::show(
            fileName: $fileName,
            filePath: $fileName,
            fileUrl: asset('storage/' . $fileName),
            disk: 'public',
            fileData: [
                ['label' => 'Uploaded by', 'value' => 'Jane Doe'],
                ['label' => 'Department',  'value' => 'Finance'],
            ]
        );
    }
}
```

Add a route in `routes/web.php`:

```
Route::get('/files/{fileName}', [FilePreviewController::class, 'show']);
```

### `LaravelFileViewer::show()` Parameters

[](#laravelfileviewershow-parameters)

ParameterTypeDefaultDescription`fileName``string`—Display name for the file`filePath``string`—Path relative to the storage disk`fileUrl``string`—Public URL used to render the preview`disk``string|null``'public'`Laravel storage disk (overrides config default)`fileData``array``[]`Key/value pairs displayed in the details panel---

⚙️ Configuration
----------------

[](#️-configuration)

After publishing the config (`config/laravel-file-viewer.php`), you can customize behavior via environment variables or directly in the config file.

```
return [
    // Default storage disk used when no disk is passed to ::show()
    'default_disk' => env('FILE_VIEWER_DISK', 'public'),

    // Fall back to Google Docs Viewer for unsupported file types
    'google_viewer_fallback' => env('FILE_VIEWER_GOOGLE_FALLBACK', false),

    // Toolbar button visibility
    'toolbar' => [
        'download'        => env('FILE_VIEWER_TOOLBAR_DOWNLOAD', true),
        'open_in_new_tab' => env('FILE_VIEWER_TOOLBAR_NEW_TAB', true),
        'copy_link'       => env('FILE_VIEWER_TOOLBAR_COPY_LINK', true),
        'fullscreen'      => env('FILE_VIEWER_TOOLBAR_FULLSCREEN', true),
    ],
];
```

### Environment Variables

[](#environment-variables)

VariableDefaultDescription`FILE_VIEWER_DISK``public`Default storage disk`FILE_VIEWER_GOOGLE_FALLBACK``false`Use Google Docs Viewer as fallback`FILE_VIEWER_TOOLBAR_DOWNLOAD``true`Show download button`FILE_VIEWER_TOOLBAR_NEW_TAB``true`Show "open in new tab" button`FILE_VIEWER_TOOLBAR_COPY_LINK``true`Show copy link button`FILE_VIEWER_TOOLBAR_FULLSCREEN``true`Show fullscreen button---

📂 Supported File Types
----------------------

[](#-supported-file-types)

CategoryTypesViewerImagesJPEG, PNG, GIF, WebP, SVG, etc.Native ``VideoMP4, WebM, OGG, etc.Native ``AudioMP3, WAV, OGG, etc.Native ``PDF`.pdf`Embedded PDF viewerWord`.docx`, `.doc`docx-preview.jsExcel`.xlsx`, `.xls`SheetJSPowerPoint`.pptx`, `.ppt`Office Online / iframeCSV`.csv`Inline tableText`.txt`, `.log`, `.md`, `.json`Syntax-highlighted textArchives`.zip`, `.rar`, `.tar`, `.gz`Details panelOtherAny unsupported typeOffice Online or Google Docs Viewer (if enabled)---

🌟 Why Laravel File Viewer?
--------------------------

[](#-why-laravel-file-viewer)

- **Save hours**: No need to wire up multiple JS libraries yourself.
- **Modern UI**: Looks great out of the box with a consistent toolbar.
- **Flexible**: Works with any Laravel storage disk — local, S3, or custom.
- **Trusted**: Used in production by agencies and startups.

---

📈 Help Us Grow!
---------------

[](#-help-us-grow)

If you find this package useful:

- ⭐ Star this repo on GitHub
- 📦 Try it in your next Laravel project
- 🐦 Tweet about it [@vish4395](https://twitter.com/vish4395)
- 💬 Share feedback and suggestions

---

📋 Changelog
-----------

[](#-changelog)

See [CHANGELOG](CHANGELOG.md) for recent updates.

---

🤝 Contributing
--------------

[](#-contributing)

PRs are welcome! See [CONTRIBUTING](CONTRIBUTING.md) for details. Questions? Email  or open an issue.

---

🔒 Security
----------

[](#-security)

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

---

👏 Credits
---------

[](#-credits)

- [Vishal Sharma](https://github.com/vish4395)
- [VolodymyrBaydalka/docxjs](https://github.com/VolodymyrBaydalka/docxjs)
- [SheetJS](https://sheetjs.com)
- [All Contributors](../../contributors)

---

📄 License
---------

[](#-license)

MIT. See [License File](LICENSE.md) for details.

---

🎬 Demo
------

[](#-demo)

    AwesomeScreenshot-1\_2\_2023.1.32.27PM.mp4    ---

⭐ Star History
--------------

[](#-star-history)

[![Star History Chart](https://camo.githubusercontent.com/15672ee262599da7b6135fa15f16a3a6891f6cd75d62ba35a81184e8405c121e/68747470733a2f2f6170692e737461722d686973746f72792e636f6d2f7376673f7265706f733d76697368343339352f6c61726176656c2d66696c652d76696577657226747970653d54696d656c696e65)](https://www.star-history.com/#vish4395/laravel-file-viewer&Timeline)

---

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance92

Actively maintained with recent releases

Popularity48

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~246 days

Recently: every ~291 days

Total

6

Last Release

46d ago

Major Versions

1.0.5 → 2.0.02026-05-20

PHP version history (2 changes)1.0.1PHP ^7.4|^8.0

1.0.5PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12929023?v=4)[Vishal Sharma](/maintainers/vish4395)[@vish4395](https://github.com/vish4395)

---

Top Contributors

[![vish4395](https://avatars.githubusercontent.com/u/12929023?v=4)](https://github.com/vish4395 "vish4395 (49 commits)")

---

Tags

vish4395laravel-file-viewer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vish4395-laravel-file-viewer/health.svg)

```
[![Health](https://phpackages.com/badges/vish4395-laravel-file-viewer/health.svg)](https://phpackages.com/packages/vish4395-laravel-file-viewer)
```

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[illuminate/filesystem

The Illuminate Filesystem package.

16165.1M3.2k](/packages/illuminate-filesystem)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
