Download the PHP package hasanhawary/media-manager without Composer

On this page you can find all versions of the php package hasanhawary/media-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package media-manager

Media Manager

Latest Stable Version Total Downloads PHP Version Tests

Media Manager is a reusable Laravel package for storing files from uploaded files, base64 strings, remote URLs, raw content, and local paths. It supports disk selection, naming strategies, replacement flows, chunked uploads, URL generation, metadata, delete, and safe delete.

The package is self-contained and does not depend on a host app namespace such as App\....

Requirements

Some low-level helpers such as PathNormalizer, FileNameGenerator, and RemoteMediaFetcher can be used in plain PHP. Storage, facades, UploadedFile, URL generation, metadata, and chunk uploads are Laravel filesystem features.

Installation

Laravel discovers the service provider and facade alias automatically:

Publish the optional config file:

Configuration

Published config: config/media-manager.php

disk => null means the package uses filesystems.default.

The package registers POST /media-manager/chunk-file by default. Change routes.prefix, routes.middleware, or set routes.enabled to false if you need to avoid route conflicts.

Quick Start

Fluent options:

If no path is passed to upload(), the package uses media-manager.path.

Supported Sources

Source Example
Uploaded file $request->file('avatar')
Base64 data URI data:image/png;base64,...
Plain base64 string base64_encode($contents)
Remote URL https://example.com/photo.jpg
Raw content Hello world
Local path storage_path('app/temp/logo.png')

Remote URLs are validated before fetching. Local/private IP URLs are rejected by default to reduce SSRF risk.

Naming

Strategy Behavior
uuid Generated UUID filename
hash MD5 hash for uploaded files, UUID fallback for generated content
timestamp Timestamp plus random suffix
original Keep the original filename when available
custom Use withName() string or closure

Filenames are sanitized with basename() before storage.

Replacing Files

Input value Behavior
null, '', or [] Keep the old path
'delete' Delete the old file and return null
Same path Keep the existing file
New source Store the new file and delete the old file after success

Chunk Uploads

Use the fluent API directly:

Key Required Description
file_name yes Final filename with extension
chunk_number yes 1-based chunk number
chunk_file yes Illuminate\Http\UploadedFile chunk
is_final no Merge chunks when true
user_id sometimes Used to isolate chunk directories
directory no Final merged file directory

If user_id is not provided, Laravel apps fall back to auth()->id(). Outside Laravel auth, user_id is required.

Chunks are stored under media-manager.chunks.directory, merged in numeric order, streamed into the final file, and then cleaned up.

Or use the default package route:

Multipart form fields:

Field Required Description
file_name yes Final filename with extension
chunk_number yes 1-based chunk number
chunk_file yes Uploaded chunk file
is_final no Boolean-ish value such as 1, true, or 0
user_id sometimes Required when no authenticated Laravel user exists
directory no Final merged file directory

Successful non-final response:

Successful final response:

URLs

url(), temporaryUrl(), and signedUrl() return null for missing paths. Arrays of paths return an array when more than one path resolves.

Metadata

MediaMeta is JSON serializable.

File Operations

exists(), delete(), and safeDelete() normalize package-generated disk URLs back to disk paths. External URLs are ignored.

safeDelete() moves files to trash/ on the selected disk.

Exceptions

The package fails explicitly for invalid usage:

Exception Example
NoHandlerDefinedException Calling store() before selecting a source
UnsupportedTypeException Passing an unsupported source type
InvalidArgumentException Invalid naming strategy, chunk data, empty disk name

ApiHandler and ZipHandler are placeholders and throw UnsupportedTypeException.

Plain PHP Notes

These classes do not require a Laravel application container:

Storage-backed operations require Laravel filesystem components.

Testing

The package test suite is isolated from any host project.

License

MIT © Hasan Hawary


All versions of media-manager with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1 <8.6
illuminate/config Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/container Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/filesystem Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/http Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.0
league/flysystem Version ^3.0
league/flysystem-local Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hasanhawary/media-manager contains the following files

Loading the files please wait ...