Download the PHP package mitsuki/storage without Composer
On this page you can find all versions of the php package mitsuki/storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mitsuki/storage
More information about mitsuki/storage
Files in mitsuki/storage
Package storage
Short Description A flexible and framework-agnostic storage library for managing structured records, originally built for the Mitsuki PHP framework and usable in any PHP application.
License MIT
Informations about the package storage
Mitsuki Storage
Mitsuki Storage is a flexible, framework-agnostic PHP library for managing file storage and structured records. Originally built for the Mitsuki framework, it provides a clean and secure abstraction over the Symfony Filesystem component to handle uploads, persistence, and file management in any PHP application.
๐ Features
- Secure Uploads: Automatic unique filename generation to prevent collisions and overwrites.
- Fluent Directory Management: Automatically handles recursive directory creation.
- Standardized Exceptions: Robust error handling with custom
FileExceptionandFileNotFoundException. - Framework Agnostic: Integration-ready for Laravel, Symfony, Slim, or any vanilla PHP project.
- Fully Tested: High-quality code base tested with Pest PHP.
๐ฆ Installation
Install the package via Composer:
๐ Usage
Initialization
To start, you need a base directory where files will be stored and an instance of Symfony's Filesystem.
Storing an Uploaded File
The store method expects a Symfony\Component\HttpFoundation\File\UploadedFile (standard in many frameworks).
Retrieving and Checking Files
Deleting Files
๐งช Testing
The library is tested using Pest PHP.
๐ API Reference
Storage Class
| Method | Argument | Description |
|---|---|---|
store() |
string $path, UploadedFile $file |
Validates, secures, and moves an upload. Returns full path. |
getFile() |
string $path |
Resolves a relative path to an absolute path. |
exists() |
string $path |
Returns true if the path exists. |
createDir() |
string $path |
Recursively creates directories. |
delete() |
string $path |
Removes a file or directory. |
๐ค Author
Zgenius Matondo
- GitHub: @zgeniusecoders
- Email: [email protected]
โ๏ธ License
This project is licensed under the MIT License - see the LICENSE file for details.
All versions of storage with dependencies
symfony/http-foundation Version ^8.0
symfony/mime Version ^8.0