PHPackages                             eliminationzx/laravel-orchid-media-library - 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. [Admin Panels](/categories/admin)
4. /
5. eliminationzx/laravel-orchid-media-library

ActivePackage[Admin Panels](/categories/admin)

eliminationzx/laravel-orchid-media-library
==========================================

Laravel Orchid Media Library Wrapper - Seamless integration of Spatie Media Library with Orchid Platform

v3.0.5(3mo ago)05MITPHPPHP ^8.3

Since Mar 22Pushed 3mo agoCompare

[ Source](https://github.com/Eliminationzx/laravel-orchid-media-library)[ Packagist](https://packagist.org/packages/eliminationzx/laravel-orchid-media-library)[ RSS](/packages/eliminationzx-laravel-orchid-media-library/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (9)Versions (11)Used By (0)

Laravel Orchid Media Library
============================

[](#laravel-orchid-media-library)

[![Latest Version on Packagist](https://camo.githubusercontent.com/97f385102a47793e523b8ec429b9bc1a1acd4ef7f83a549264983804b8c2a9f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c696d696e6174696f6e7a782f6c61726176656c2d6f72636869642d6d656469612d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eliminationzx/laravel-orchid-media-library)[![Total Downloads](https://camo.githubusercontent.com/f5b0991d65a9402975859270bc2aaa397c41afd86cdf6bae57e1afbcc82fe1f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c696d696e6174696f6e7a782f6c61726176656c2d6f72636869642d6d656469612d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eliminationzx/laravel-orchid-media-library)[![PHP Version](https://camo.githubusercontent.com/2a1b55853e4506a41953e2e22f5a37ff2c5b4e29f57a9167ca46a5b6a05aea68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f656c696d696e6174696f6e7a782f6c61726176656c2d6f72636869642d6d656469612d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eliminationzx/laravel-orchid-media-library)[![License](https://camo.githubusercontent.com/15a68262fff841db8ab51e0ef64809295fe07618185ae555cb565af77d7d45dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656c696d696e6174696f6e7a782f6c61726176656c2d6f72636869642d6d656469612d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A comprehensive media management package for Laravel Orchid Platform that seamlessly integrates Spatie's Laravel Media Library with Orchid's admin interface. This package provides a complete media management solution with configuration-driven customization, comprehensive testing, and modern PHP 8.3+ features.

✨ Features
----------

[](#-features)

- **Complete Media Management**: Upload, organize, and manage media files through Orchid's admin interface
- **Configuration-Driven**: Extensive configuration system for customizing every aspect of the media library
- **Modern PHP Support**: Built with PHP 8.3+ features including strict typing and modern patterns
- **Comprehensive Testing**: Full test suite with PHPUnit and PHPStan integration
- **Image Conversions**: Built-in image conversion system with configurable presets
- **Responsive Components**: Blade components for displaying media in your applications
- **Type Safety**: Full type hints and PHPStan level 9 compliance
- **Developer Experience**: Laravel Pint for code formatting, comprehensive IDE support

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

[](#-requirements)

- PHP 8.3 or higher
- Laravel 10.x or 11.x
- Orchid Platform 14.x
- Spatie Laravel Media Library 11.x

🚀 Installation
--------------

[](#-installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require eliminationzx/laravel-orchid-media-library
```

### 2. Install Package Resources

[](#2-install-package-resources)

Run the installation command to set up the package:

```
php artisan orchid-media-library:install
```

This command will:

- Publish stubs for screens, routes, and images
- Set up the necessary database migrations (if using Spatie Media Library)
- Configure the basic package structure

### 4. Run Migrations

[](#4-run-migrations)

If you haven't already installed Spatie's Media Library, run its migrations:

```
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="media-library-migrations"
php artisan migrate
```

⚙️ Configuration-Free Architecture
----------------------------------

[](#️-configuration-free-architecture)

This package uses a configuration-free architecture with sensible defaults. Instead of configuration files, it uses:

### 1. **Constants for Defaults**

[](#1-constants-for-defaults)

All package settings are defined as class constants with sensible defaults:

```
// MediaService constants
MediaService::SCREEN_NAME = 'Media'
MediaService::SCREEN_ICON = 'film'
MediaService::SCREEN_PLURAL = 'media'
MediaService::ROUTE_PREFIX = 'platform'
MediaService::ROUTE_MIDDLEWARE = ['web', 'platform']
MediaService::ALLOWED_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif']

// ConversionService constants
ConversionService::PLATFORM_CONVERSION = [
    'width' => 100,
    'height' => 100,
    'crop' => 'center',
    'quality' => 70,
    'optimize' => true,
    'queue' => false,
    'enabled' => true,
]
```

### 2. **Runtime Customization API**

[](#2-runtime-customization-api)

Customize settings at runtime without configuration files:

```
// Customize media library settings
MediaService::customize([
    'screen_name' => 'Media Files',
    'screen_icon' => 'image',
    'allowed_mime_types' => ['image/jpeg', 'image/png', 'image/gif', 'image/webp'],
    'route_middleware' => ['web', 'platform', 'auth'],
]);

// Get customized values
$allowedTypes = MediaService::getAllowedMimeTypes();
$routePrefix = MediaService::getRoutePrefix();
```

### 3. **Spatie Media Library Configuration**

[](#3-spatie-media-library-configuration)

Media-specific settings use Spatie's Media Library configuration (`config/media-library.php`):

```
// The package respects Spatie's configuration for:
// - Disk name (config('media-library.disk_name'))
// - Max file size (config('media-library.max_file_size'))
// - Image quality (config('media-library.image_quality'))
// - And other media-specific settings
```

### 4. **Available Customization Options**

[](#4-available-customization-options)

SettingConstantDefaultCustomization MethodScreen Name`SCREEN_NAME``'Media'``MediaService::customize(['screen_name' => '...'])`Screen Icon`SCREEN_ICON``'film'``MediaService::customize(['screen_icon' => '...'])`Route Prefix`ROUTE_PREFIX``'platform'``MediaService::customize(['route_prefix' => '...'])`Route Middleware`ROUTE_MIDDLEWARE``['web', 'platform']``MediaService::customize(['route_middleware' => [...]])`Allowed MIME Types`ALLOWED_MIME_TYPES``['image/jpeg', 'image/png', 'image/gif']``MediaService::customize(['allowed_mime_types' => [...]])`Platform Conversion`PLATFORM_CONVERSION`See aboveModify `ConversionService::PLATFORM_CONVERSION` constantOpenGraph Conversion`OPENGRAPH_CONVERSION`128x128, center cropModify `ConversionService::OPENGRAPH_CONVERSION` constantThumbnail Conversion`THUMBNAIL_CONVERSION`300x300, center cropModify `ConversionService::THUMBNAIL_CONVERSION` constant### 5. **Resetting Customizations**

[](#5-resetting-customizations)

Clear runtime customizations to restore defaults:

```
MediaService::clearCustomizations();
```

📖 Usage
-------

[](#-usage)

### Accessing Media in Orchid Admin

[](#accessing-media-in-orchid-admin)

Once installed, the media library will be available in your Orchid admin panel at `/platform/media`. You can:

1. **Upload Files**: Drag and drop or click to upload media files
2. **Organize Media**: Create collections, add descriptions, and manage metadata
3. **Preview Media**: View images, documents, and other file types
4. **Edit Metadata**: Update file names, descriptions, and other properties

### Using Media Service

[](#using-media-service)

The package provides a `MediaService` class for accessing configuration-based settings:

```
use Orchid\MediaLibrary\Services\MediaService;

// Get screen configuration
$screenName = MediaService::getName(); // 'Media'
$screenIcon = MediaService::getIcon(); // 'film'

// Get route names
$listRoute = MediaService::getRouteList(); // 'platform.media.list'
$showRoute = MediaService::getRouteShow(); // 'platform.media.show'
$editRoute = MediaService::getRouteEdit(); // 'platform.media.edit'
```

### Using Conversion Service

[](#using-conversion-service)

The `ConversionService` provides methods for working with image conversions:

```
use Orchid\MediaLibrary\Services\ConversionService;

// Apply a conversion to media
$convertedUrl = ConversionService::applyConversion($media, 'thumbnail');

// Check if a conversion is enabled
if (ConversionService::isConversionEnabled('platform')) {
    // Apply platform conversion
}
```

### Blade Components

[](#blade-components)

Use the included Blade components to display media in your views:

```
{{-- Image preview component --}}

{{-- Media link component --}}

```

### Table Definitions in Orchid Screens

[](#table-definitions-in-orchid-screens)

Use the included TD (Table Definition) components in your Orchid screens:

```
use Orchid\MediaLibrary\Orchid\Helpers\TD\ImagePreviewTD;

TD::make('preview', 'Preview')
    ->component(ImagePreviewTD::class)
    ->width('100px'),
```

🧪 Testing
---------

[](#-testing)

The package includes a comprehensive test suite. To run tests:

```
# Run all tests
composer test

# Run tests with coverage report
composer test-coverage

# Run static analysis with PHPStan
composer analyse

# Format code with Laravel Pint
composer format
```

### Test Structure

[](#test-structure)

- **Unit Tests**: Test individual components and services
- **Feature Tests**: Test integration with Laravel and Orchid
- **Provider Tests**: Test service provider registration and bootstrapping

🏗️ Development
--------------

[](#️-development)

### Development Setup

[](#development-setup)

1. Clone the repository
2. Install dependencies: `composer install`
3. Run tests: `composer test`
4. Check code quality: `composer analyse`

### Code Style

[](#code-style)

The package uses Laravel Pint for code formatting. Run `composer format` to automatically format code according to the project standards.

### Static Analysis

[](#static-analysis)

PHPStan is configured at level 9 for maximum type safety. Run `composer analyse` to check for type errors and code quality issues.

📄 License
---------

[](#-license)

This package is open-source software licensed under the [MIT license](LICENSE.md).

🏆 Credits
---------

[](#-credits)

- [Eliminationzx](https://github.com/eliminationzx)
- [Spatie](https://spatie.be) - For the excellent Laravel Media Library package
- [Orchid Platform](https://orchid.software) - For the powerful Laravel admin panel
- [All Contributors](../../contributors)

🔗 Links
-------

[](#-links)

- [Packagist](https://packagist.org/packages/eliminationzx/laravel-orchid-media-library)
- [GitHub Repository](https://github.com/eliminationzx/laravel-orchid-media-library)
- [Orchid Documentation](https://orchid.software/en/docs)
- [Laravel Media Library Documentation](https://spatie.be/docs/laravel-medialibrary/v11/introduction)

---

**Laravel Orchid Media Library** - Professional media management for Laravel Orchid applications.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.3% 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

10

Last Release

96d ago

Major Versions

v1.0.1 → v2.0.02026-03-22

v2.0.1 → v3.0.02026-03-22

PHP version history (2 changes)v1.0.0PHP ^8.3

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/355fba5be6e2f2ae301ca9730c64c7351c7cd628e307b76174499e45b5f34d6a?d=identicon)[Eliminationzx](/maintainers/Eliminationzx)

---

Top Contributors

[![Eliminationzx](https://avatars.githubusercontent.com/u/2004626?v=4)](https://github.com/Eliminationzx "Eliminationzx (18 commits)")[![Manzadey](https://avatars.githubusercontent.com/u/34869211?v=4)](https://github.com/Manzadey "Manzadey (5 commits)")

---

Tags

spatielaravelcmsadminmedia libraryorchid

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/eliminationzx-laravel-orchid-media-library/health.svg)

```
[![Health](https://phpackages.com/badges/eliminationzx-laravel-orchid-media-library/health.svg)](https://phpackages.com/packages/eliminationzx-laravel-orchid-media-library)
```

###  Alternatives

[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[orchid/platform

Platform for back-office applications, admin panel or CMS your Laravel app.

4.8k2.5M66](/packages/orchid-platform)[arbory/arbory

Administration interface for Laravel

4753.9k3](/packages/arbory-arbory)[printnow/laravel-admin

Dcat admin 永久分叉版 / 支持 Laravel 10-13, PHP 版本限制 &gt;= 8.1（支持 PHP 8.5）

472.4k](/packages/printnow-laravel-admin)[slimani/filament-media-manager

A media manager plugin for Filament.

115.1k](/packages/slimani-filament-media-manager)

PHPackages © 2026

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