PHPackages                             parvez/laravel-gallery-manager - 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. parvez/laravel-gallery-manager

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

parvez/laravel-gallery-manager
==============================

A comprehensive Laravel package for managing media files (images, videos, documents, audio) with hierarchical folder structure, supporting both local and AWS S3 storage

v2.0.0(3mo ago)42MITPHPPHP ^8.1|^8.2|^8.3

Since Feb 3Pushed 3mo agoCompare

[ Source](https://github.com/PARVEZFCI/laravel-gallery-manager)[ Packagist](https://packagist.org/packages/parvez/laravel-gallery-manager)[ RSS](/packages/parvez-laravel-gallery-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Laravel Gallery Manager
=======================

[](#laravel-gallery-manager)

A comprehensive Laravel package for managing media files (images, videos, documents, audio) with hierarchical folder structure. Supports both local and AWS S3 storage.

Features
--------

[](#features)

- 📁 **Hierarchical Folder Structure** - Organize media with parent-child folder relationships
- 🎨 **Multi-File Type Support** - Images, Videos, Documents, Audio, and more
- 🏷️ **Tagging System** - Tag and categorize your media files
- ☁️ **Cloud Storage** - Support for local, public, and AWS S3 storage
- 🔐 **User Management** - Optional user-specific media organization
- 🗑️ **Soft Deletes** - Safely delete and restore media and folders
- 📊 **Auto-calculated Metrics** - Automatic folder size and media count
- 🔍 **Search &amp; Filter** - Search by name, type, tags, and folders
- 🎯 **RESTful API** - Complete API for media and folder management
- 📦 **Easy Integration** - Simple installation and configuration

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.0
- intervention/image ^3.0 (optional, for image processing)

Installation
------------

[](#installation)

```
composer require parvez/laravel-gallery-manager
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --tag=gallery-config
```

### Publish Migrations

[](#publish-migrations)

```
php artisan vendor:publish --tag=gallery-migrations
php artisan migrate
```

### Publish Vue Components (Optional)

[](#publish-vue-components-optional)

```
php artisan vendor:publish --tag=gallery-components
php artisan vendor:publish --tag=gallery-css
```

Configuration
-------------

[](#configuration)

Edit `config/gallery-manager.php`:

```
return [
    'disk' => env('GALLERY_DISK', 'public'),
    'storage_path' => env('GALLERY_STORAGE_PATH', 'media'),
    'max_size' => env('GALLERY_MAX_SIZE', 10240), // KB

    'allowed_mimes' => [
        // Images, Videos, Documents, Audio
        'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg',
        'mp4', 'avi', 'mov', 'wmv',
        'pdf', 'doc', 'docx', 'xls', 'xlsx',
        'mp3', 'wav', 'ogg',
    ],

    'routes' => [
        'prefix' => 'api/gallery',
        'middleware' => ['api', 'auth:sanctum'],
    ],
];
```

Database Schema
---------------

[](#database-schema)

### Tables

[](#tables)

**media** - Stores media files

- `id`, `user_id`, `original`, `name`, `type` (enum: image, video, document, audio, other)
- `path`, `folder_id`, `url`, `mime_type`, `extension`
- `size`, `width`, `height`, `duration`
- `created_at`, `updated_at`, `deleted_at`

**folders** - Hierarchical folder structure

- `id`, `name`, `user_id`, `parent_id`
- `created_at`, `updated_at`, `deleted_at`

**tags** - Media tags

- `id`, `name`, `slug`
- `created_at`, `updated_at`

**media\_tag** - Pivot table for media-tag relationships

API Endpoints
-------------

[](#api-endpoints)

### Media Endpoints

[](#media-endpoints)

```
GET    /api/gallery/media              # List media with filters
POST   /api/gallery/media              # Upload media file(s)
GET    /api/gallery/media/{id}         # Get media details
PUT    /api/gallery/media/{id}         # Update media
DELETE /api/gallery/media/{id}         # Delete media
GET    /api/gallery/media/{id}/download # Download media
POST   /api/gallery/media/bulk-delete  # Bulk delete media
```

### Folder Endpoints

[](#folder-endpoints)

```
GET    /api/gallery/folders            # List folders
POST   /api/gallery/folders            # Create folder
GET    /api/gallery/folders/{id}       # Get folder details
PUT    /api/gallery/folders/{id}       # Update folder
DELETE /api/gallery/folders/{id}       # Delete folder (recursive)
```

Usage Examples
--------------

[](#usage-examples)

### Upload Media

[](#upload-media)

```
use Parvez\GalleryManager\Services\MediaService;

$mediaService = app(MediaService::class);

$media = $mediaService->upload($request->file('file'), auth()->id(), [
    'name' => 'My Photo',
    'folder_id' => 1,
    'tags' => [1, 2, 3],
]);
```

### Create Folder

[](#create-folder)

```
$folder = $mediaService->createFolder('Photos', auth()->id(), $parentId = null);
```

### Get Media with Filters

[](#get-media-with-filters)

```
$media = $mediaService->getMedia(auth()->id(), [
    'folder_id' => 1,
    'type' => 'image',
    'search' => 'vacation',
    'tags' => [1, 2],
    'per_page' => 20,
]);
```

### Using Facade

[](#using-facade)

```
use Parvez\GalleryManager\Facades\Gallery;

$media = Gallery::upload($file, $userId);
```

Models
------

[](#models)

### Media Model

[](#media-model)

```
use Parvez\GalleryManager\Models\Media;

// Relationships
$media->user();
$media->folder();
$media->tags();

// Helper Methods
$media->isImage();
$media->isVideo();
$media->isDocument();
$media->isAudio();

// Attributes
$media->formatted_size; // e.g., "2.5 MB"
$media->url; // Full URL to the file
```

### Folder Model

[](#folder-model)

```
use Parvez\GalleryManager\Models\Folder;

// Relationships
$folder->user();
$folder->parent();
$folder->children();
$folder->media();

// Computed Attributes
$folder->media_count;
$folder->total_size;
$folder->formatted_size;

// Helper Methods
$folder->getBreadcrumb(); // Get full path hierarchy
```

### Tag Model

[](#tag-model)

```
use Parvez\GalleryManager\Models\Tag;

$tag->media(); // Get all media with this tag
```

Frontend Integration
--------------------

[](#frontend-integration)

Upload media with JavaScript:

```
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('name', 'My File');
formData.append('folder_id', 1);
formData.append('tags', JSON.stringify([1, 2]));

await axios.post('/api/gallery/media', formData, {
    headers: { 'Content-Type': 'multipart/form-data' }
});
```

File Type Detection
-------------------

[](#file-type-detection)

The package automatically detects file types based on MIME type:

- **Images**: `image/*`
- **Videos**: `video/*`
- **Audio**: `audio/*`
- **Documents**: PDF, Word, Excel, PowerPoint, etc.
- **Other**: Everything else

Authorization
-------------

[](#authorization)

The package includes basic authorization checks. Media and folders can be:

- **User-specific**: `user_id` is set (only owner can access)
- **Public**: `user_id` is null (anyone can access)

You can customize authorization in the `MediaController`.

Testing
-------

[](#testing)

```
composer test
```

Security
--------

[](#security)

- File size limits
- MIME type validation
- User authorization checks
- Soft deletes for safe data management

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit PRs or open issues.

License
-------

[](#license)

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

Credits
-------

[](#credits)

- **Author**: Parvez Rahman
- **Email**:

Changelog
---------

[](#changelog)

### Version 2.0.0

[](#version-200)

- ✅ Complete rewrite with new database schema
- ✅ Multi-file type support (images, videos, documents, audio)
- ✅ Hierarchical folder structure
- ✅ Improved API endpoints
- ✅ Better resource transformers
- ✅ Simplified configuration
- ✅ Enhanced models with relationships

### Version 1.x

[](#version-1x)

- Basic image gallery functionality
- Date-based organization
- Local and S3 storage

Support
-------

[](#support)

For issues and questions:

- Open an issue on GitHub
- Email:

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance82

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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 ~0 days

Total

4

Last Release

96d ago

Major Versions

v1.0.2 → v2.0.02026-02-05

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.0|^8.1|^8.2|^8.3

v2.0.0PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/d31ee8e601353c7d2f3437c602bd3ea5cc8c52bf3b60e26f103e819c1f08d9e8?d=identicon)[PARVEZFCI](/maintainers/PARVEZFCI)

---

Top Contributors

[![PARVEZFCI](https://avatars.githubusercontent.com/u/56005908?v=4)](https://github.com/PARVEZFCI "PARVEZFCI (8 commits)")

---

Tags

laravels3storagemediauploadgalleryfile manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/parvez-laravel-gallery-manager/health.svg)

```
[![Health](https://phpackages.com/badges/parvez-laravel-gallery-manager/health.svg)](https://phpackages.com/packages/parvez-laravel-gallery-manager)
```

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[mostafaznv/larupload

Larupload is a ORM based file uploader for laravel to upload image, video, audio and other known files.

73403.7k3](/packages/mostafaznv-larupload)[mwguerra/filemanager

A full-featured file manager package for Laravel and Filament v5 with dual operating modes, drag-and-drop uploads, S3/MinIO support, and comprehensive security features.

718.5k1](/packages/mwguerra-filemanager)[mafftor/laravel-file-manager

The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox

3619.3k](/packages/mafftor-laravel-file-manager)

PHPackages © 2026

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