PHPackages                             codrasil/mediabox - 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. codrasil/mediabox

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

codrasil/mediabox
=================

A PHP implementation of a web-based file management system

v1.1.1(5y ago)7131[2 PRs](https://github.com/codrasil/mediabox/pulls)MITPHP

Since Jun 4Pushed 4y ago2 watchersCompare

[ Source](https://github.com/codrasil/mediabox)[ Packagist](https://packagist.org/packages/codrasil/mediabox)[ RSS](/packages/codrasil-mediabox/feed)WikiDiscussions master Synced 1w ago

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

[![](./logo.svg)](./logo.svg)

 [![Latest Stable Version](https://camo.githubusercontent.com/751182d4fc967527f3d1e8b965ed00101185c5ee25632db2c49693ee2c9eb00f/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f6d65646961626f782f76)](//packagist.org/packages/codrasil/mediabox) [![Total Downloads](https://camo.githubusercontent.com/75560ba0e00f40af00197d277f4bb4a042e4a4441ca436c89b3cdb1fdb19d09e/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f6d65646961626f782f646f776e6c6f616473)](//packagist.org/packages/codrasil/mediabox) [![Latest Unstable Version](https://camo.githubusercontent.com/5307c795651522826aee0ad56bb41283fa3fa08ce37b6c6131b2d36117441f97/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f6d65646961626f782f762f756e737461626c65)](//packagist.org/packages/codrasil/mediabox) [![License](https://camo.githubusercontent.com/e830e714b9a6308ca51c9230ee537f7ff3bca524456158557bf31343d90a743f/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f6d65646961626f782f6c6963656e7365)](//packagist.org/packages/codrasil/mediabox)

About Mediabox
--------------

[](#about-mediabox)

Mediabox is a PHP implementation of a **web-based file management system**. The library makes it easy to interact with the local disk storage's files and folders.

Features include:

- Adding of files and folders
- Copying
- Deleting files from disk
- Displaying and downloading files from browser
- Renaming and Moving files and folders.
- Toggling of hidden files
- Easy syntax to retrieve file meta info like size, permission, last modified date, owner, etc.

Mediabox is also a [Laravel](https://github.com/laravel/laravel) package out-of-the-box with minimal setup.

### Demonstration

[](#demonstration)

Clone or download this repository then run the `demo:plain` composer script:

```
git clone https://github.com/codrasil/mediabox
cd mediabox/ && composer install
composer demo:plain
```

The above command will run a built-in PHP server at localhost:8080.

[![Screenshot of the demo](./demos/plain/screenshot.png)](./demos/plain/screenshot.png)

You may also run `composer demo:prep` to generate dummy files and folders for the demo.

---

### Requirements

[](#requirements)

- `PHP 7+`
- `php-imagick` (optional; for generating thumbnails)
- `illuminate/cache`: `^7.15`
- `illuminate/filesystem`: `^7.11`
- `symfony/http-foundation`: `^5.0`

### Installation

[](#installation)

The library can be installed via composer:

```
composer require codrasil/mediabox
```

##### Publishing Configuration

[](#publishing-configuration)

If used in a Laravel project, the configuration file can be published via `artisan` command:

```
php artisan vendor:publish --tag mediabox
```

See [docs/Laravel](./docs/Laravel/00.%20Getting%20Started.md) for instructions on how to setup in a Laravel project.

### Usage

[](#usage)

##### Plain PHP

[](#plain-php)

```
use Codrasil\Mediabox\Mediabox;

...

$rootStoragePath = '/path/to/a/storage/folder';
$baseStoragePath = $_GET['p'] ?: $rootStoragePath;

$mediabox = new Mediabox($baseStoragePath, $rootStoragePath);

$mediabox->showHiddenFiles($yes = true);

foreach ($mediabox->all() as $file) {
    if ($file->isDir()) {
        echo $file->name().'/'.PHP_EOL;
    } else {
        echo $file->name().PHP_EOL;
    }
}
```

##### Laravel

[](#laravel)

If using within a Laravel project, just inject the `Codrasil\Mediabox\Mediabox` class to a controller or another class.

```
// routes/web.php

use Codrasil\Mediabox\Mediabox;
use Illuminate\Http\Request;

Route::get('media', function (Request $request, Mediabox $mediabox) {
    return view('path.to.a.view')->withMediabox($mediabox);
});
```

```
{{-- resources/views/path/to/a/view.blade.php --}}

@foreach ($mediabox->all() as $file)
  @if ($file->isDir())
    &nbsp;{{ $file->name() }}/
  @else
    &nbsp;{{ $file->name() }}
  @endif
@endforeach
```

Note by default, the library will list the files and folders listed in `storage/app/public/media`. To change the path, update the `root_path` value in `config/mediabox.php` file.

All the necessary setup is taken cared of by the `Codrasil\Mediabox\MediaboxServiceProvider` class.

See `config/mediabox.php` to view all available customization options.

See also [docs/Laravel](./docs/Laravel/00.%20Getting%20Started.md) for more information on how to use the library on a Laravel project.

#### Adding

[](#adding)

```
$mediabox->addFolder('Reminders');
$mediabox->addFile('Reminders/groceries.todo', 'Milk');
```

Adding folders is recursive by default.

#### Copying

[](#copying)

The `copy` method accepts the relative path of the file to be copied as first argument. The second argument is the new file name.

```
$mediabox->copy('Reminders/groceries.todo', 'Copy of groceries.todo');

$mediabox->copy('Reminders', 'Copy of Reminders');
// or
$mediabox->copyDirectory('Reminders', 'Copy of Reminders');
```

#### Moving or renaming

[](#moving-or-renaming)

The `rename` and `move` methods accept a `$path` and `$target` destination.

```
$mediabox->rename('Reminders/groceries.todo', 'Reminders/My Grocery List.todo');
// or
$mediabox->move('Reminders/groceries.todo', 'Reminders/My Grocery List.todo');
```

#### Deleting

[](#deleting)

The `delete` method can accept a path or array of paths.

```
$mediabox->delete('Copy of Reminders');
$mediabox->delete('Copy of groceries.todo');
// or
$mediabox->delete(['Copy of Reminders', 'Copy of groceries.todo']);
```

#### Displaying &amp; Downloading

[](#displaying--downloading)

To display a file on a browser, use the `stream` or `fetch` method.

```
$mediabox->stream('/path/to/a/file.txt');
// or
$mediabox->fetch('/path/to/a/file.txt');
```

To force browser to download the file, use the `download` method.

```
$mediabox->download('/path/to/a/file.txt');
```

Both methods will return an instance of `Symfony\Component\HttpFoundation\BinaryFileResponse`.

### Documentation &amp; Examples

[](#documentation--examples)

To learn more about the API, see the [docs](./docs) folder.

For more example implementation, checkout [docs/examples](./docs/examples) folder.

For instructions on how to use in a Laravel project, see [docs/Laravel](./docs/Laravel/00.%20Getting%20Started.md).

For instructions on how to use in a Laravel + VueJS project, see [docs/VueJS](./docs/VueJS/00.%20Getting%20Started.md).

### License

[](#license)

The library is open-source software licensed under the [MIT license](./LICENSE).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96% 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 ~26 days

Total

4

Last Release

2096d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15792724?v=4)[John Lioneil Dionisio](/maintainers/lioneil)[@lioneil](https://github.com/lioneil)

---

Top Contributors

[![lioneil](https://avatars.githubusercontent.com/u/15792724?v=4)](https://github.com/lioneil "lioneil (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

fileexplorerfilemanagerlaravelmediamanager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codrasil-mediabox/health.svg)

```
[![Health](https://phpackages.com/badges/codrasil-mediabox/health.svg)](https://phpackages.com/packages/codrasil-mediabox)
```

###  Alternatives

[vich/uploader-bundle

Ease file uploads attached to entities

1.9k25.9M116](/packages/vich-uploader-bundle)[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)[spatie/laravel-google-cloud-storage

Google Cloud Storage filesystem driver for Laravel

2408.9M13](/packages/spatie-laravel-google-cloud-storage)[azure-oss/storage-blob-laravel

Azure Storage Blob filesystem driver for Laravel

63582.2k1](/packages/azure-oss-storage-blob-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[andrewelkins/cabinet

Laravel 4 file upload package.

1011.5k](/packages/andrewelkins-cabinet)

PHPackages © 2026

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