{"id":36280149,"url":"https://github.com/codrasil/mediabox","last_synced_at":"2026-01-11T09:03:08.279Z","repository":{"id":49071113,"uuid":"265181008","full_name":"codrasil/mediabox","owner":"codrasil","description":"Mediabox is a PHP implementation of a web-based file management system.","archived":false,"fork":false,"pushed_at":"2021-06-29T13:57:11.000Z","size":624,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-29T02:42:52.730Z","etag":null,"topics":["fileexplorer","filemanager","laravel","mediamanager"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/codrasil/mediabox","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codrasil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-19T07:49:28.000Z","updated_at":"2024-10-10T16:30:39.000Z","dependencies_parsed_at":"2022-09-14T21:11:56.999Z","dependency_job_id":null,"html_url":"https://github.com/codrasil/mediabox","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/codrasil/mediabox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codrasil%2Fmediabox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codrasil%2Fmediabox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codrasil%2Fmediabox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codrasil%2Fmediabox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codrasil","download_url":"https://codeload.github.com/codrasil/mediabox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codrasil%2Fmediabox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28298877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T08:21:30.231Z","status":"ssl_error","status_checked_at":"2026-01-11T08:21:26.882Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fileexplorer","filemanager","laravel","mediamanager"],"created_at":"2026-01-11T09:03:08.177Z","updated_at":"2026-01-11T09:03:08.263Z","avatar_url":"https://github.com/codrasil.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"./logo.svg\" width=\"300\"\u003e\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"//packagist.org/packages/codrasil/mediabox\"\u003e\u003cimg src=\"https://poser.pugx.org/codrasil/mediabox/v\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"//packagist.org/packages/codrasil/mediabox\"\u003e\u003cimg src=\"https://poser.pugx.org/codrasil/mediabox/downloads\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"//packagist.org/packages/codrasil/mediabox\"\u003e\u003cimg src=\"https://poser.pugx.org/codrasil/mediabox/v/unstable\" alt=\"Latest Unstable Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"//packagist.org/packages/codrasil/mediabox\"\u003e\u003cimg src=\"https://poser.pugx.org/codrasil/mediabox/license\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## About Mediabox\n\nMediabox 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.\n\nFeatures include:\n\n* Adding of files and folders\n* Copying\n* Deleting files from disk\n* Displaying and downloading files from browser\n* Renaming and Moving files and folders.\n* Toggling of hidden files\n* Easy syntax to retrieve file meta info like size, permission, last modified date, owner, etc.\n\nMediabox is also a [Laravel](https://github.com/laravel/laravel) package out-of-the-box with minimal setup.\n\n\u003cbr\u003e\n\n### Demonstration\nClone or download this repository then run the `demo:plain` composer script:\n```bash\ngit clone https://github.com/codrasil/mediabox\ncd mediabox/ \u0026\u0026 composer install\ncomposer demo:plain\n```\nThe above command will run a built-in PHP server at localhost:8080.\n\n![Screenshot of the demo](./demos/plain/screenshot.png)\n\nYou may also run `composer demo:prep` to generate dummy files and folders for the demo.\n\n\u003cbr\u003e\n\n---\n\n### Requirements\n\n* `PHP 7+`\n* `php-imagick` (optional; for generating thumbnails)\n* `illuminate/cache`: `^7.15`\n* `illuminate/filesystem`: `^7.11`\n* `symfony/http-foundation`: `^5.0`\n\n\u003cbr\u003e\n\n### Installation\n\nThe library can be installed via composer:\n```bash\ncomposer require codrasil/mediabox\n```\n\n\u003cbr\u003e\n\n##### Publishing Configuration\nIf used in a Laravel project, the configuration file can be published via `artisan` command:\n\n```bash\nphp artisan vendor:publish --tag mediabox\n```\n\nSee [docs/Laravel](./docs/Laravel/00.%20Getting%20Started.md) for instructions on how to setup in a Laravel project.\n\n\u003cbr\u003e\n\n### Usage\n\n##### Plain PHP\n\n```php\nuse Codrasil\\Mediabox\\Mediabox;\n\n...\n\n$rootStoragePath = '/path/to/a/storage/folder';\n$baseStoragePath = $_GET['p'] ?: $rootStoragePath;\n\n$mediabox = new Mediabox($baseStoragePath, $rootStoragePath);\n\n$mediabox-\u003eshowHiddenFiles($yes = true);\n\nforeach ($mediabox-\u003eall() as $file) {\n    if ($file-\u003eisDir()) {\n        echo $file-\u003ename().'/'.PHP_EOL;\n    } else {\n        echo $file-\u003ename().PHP_EOL;\n    }\n}\n```\n\n##### Laravel\n\nIf using within a Laravel project, just inject the `Codrasil\\Mediabox\\Mediabox` class to a controller or another class.\n\n```php\n// routes/web.php\n\nuse Codrasil\\Mediabox\\Mediabox;\nuse Illuminate\\Http\\Request;\n\nRoute::get('media', function (Request $request, Mediabox $mediabox) {\n    return view('path.to.a.view')-\u003ewithMediabox($mediabox);\n});\n```\n\n```blade\n{{-- resources/views/path/to/a/view.blade.php --}}\n\n@foreach ($mediabox-\u003eall() as $file)\n  @if ($file-\u003eisDir())\n    \u003cp\u003e\u003ci class=\"{{ $file-\u003eicon() }}\"\u003e\u0026nbsp;\u003c/i\u003e{{ $file-\u003ename() }}/\u003c/p\u003e\n  @else\n    \u003cp\u003e\u003ci class=\"{{ $file-\u003eicon() }}\"\u003e\u0026nbsp;\u003c/i\u003e{{ $file-\u003ename() }}\u003c/p\u003e\n  @endif\n@endforeach\n```\n\nNote by default, the library will list the files and folders listed in `storage/app/public/media`.\nTo change the path, update the `root_path` value in `config/mediabox.php` file.\n\nAll the necessary setup is taken cared of by the `Codrasil\\Mediabox\\MediaboxServiceProvider` class.\n\nSee `config/mediabox.php` to view all available customization options.\n\nSee also [docs/Laravel](./docs/Laravel/00.%20Getting%20Started.md) for more information on how to use the library on a Laravel project.\n\n\u003cbr\u003e\n\n#### Adding\n```php\n$mediabox-\u003eaddFolder('Reminders');\n$mediabox-\u003eaddFile('Reminders/groceries.todo', 'Milk');\n```\nAdding folders is recursive by default.\n\n\u003cbr\u003e\n\n#### Copying\nThe `copy` method accepts the relative path of the file to be copied as first argument.\nThe second argument is the new file name.\n\n```php\n$mediabox-\u003ecopy('Reminders/groceries.todo', 'Copy of groceries.todo');\n\n$mediabox-\u003ecopy('Reminders', 'Copy of Reminders');\n// or\n$mediabox-\u003ecopyDirectory('Reminders', 'Copy of Reminders');\n\n```\n\n\u003cbr\u003e\n\n#### Moving or renaming\nThe `rename` and `move` methods accept a `$path` and `$target` destination.\n```php\n$mediabox-\u003erename('Reminders/groceries.todo', 'Reminders/My Grocery List.todo');\n// or\n$mediabox-\u003emove('Reminders/groceries.todo', 'Reminders/My Grocery List.todo');\n```\n\n\u003cbr\u003e\n\n#### Deleting\nThe `delete` method can accept a path or array of paths.\n```php\n$mediabox-\u003edelete('Copy of Reminders');\n$mediabox-\u003edelete('Copy of groceries.todo');\n// or\n$mediabox-\u003edelete(['Copy of Reminders', 'Copy of groceries.todo']);\n```\n\n\u003cbr\u003e\n\n#### Displaying \u0026 Downloading\nTo display a file on a browser, use the `stream` or `fetch` method.\n```php\n$mediabox-\u003estream('/path/to/a/file.txt');\n// or\n$mediabox-\u003efetch('/path/to/a/file.txt');\n```\n\nTo force browser to download the file, use the `download` method.\n```php\n$mediabox-\u003edownload('/path/to/a/file.txt');\n```\n\nBoth methods will return an instance of `Symfony\\Component\\HttpFoundation\\BinaryFileResponse`.\n\n\u003cbr\u003e\n\n### Documentation \u0026 Examples\n\nTo learn more about the API, see the [docs](./docs) folder.\n\nFor more example implementation, checkout [docs/examples](./docs/examples) folder.\n\nFor instructions on how to use in a Laravel project, see [docs/Laravel](./docs/Laravel/00.%20Getting%20Started.md).\n\nFor instructions on how to use in a Laravel + VueJS project, see [docs/VueJS](./docs/VueJS/00.%20Getting%20Started.md).\n\n\u003cbr\u003e\n\n### License\nThe library is open-source software licensed under the [MIT license](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodrasil%2Fmediabox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodrasil%2Fmediabox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodrasil%2Fmediabox/lists"}