Central Storage is a storage engine built in Laravel. It includes duplicate upload detection, supports on the fly image (but cached) image resize and allows you to set 'Processors' that handle more complex file transformations like video transcoding etc.
Please follow the setup instructions described in the central storage project page to setup to storage system. Once that has been setup, you can include this library in your project to start storing assets.
Central Storage provides a standard REST API and is consumable by any language or framework.
Install via composer:
composer require catlabinteractive/central-storage-client
Initialize the client with your Central Storage server URL and credentials:
$client = new \CatLab\CentralStorage\Client\CentralStorageClient(
'https://storage.example.com',
$consumerKey,
$consumerSecret
);
// Store a local file
$asset = $client->store('/tmp/upload-tmpfile', 'photo.jpg', [ 'publisher' => 1 ]);
echo $client->getAssetUrl($asset);
// Remove it again
$client->delete($asset);The store() method accepts:
- A file path (string) or
SplFileInfoobject as the first argument - An optional filename (defaults to the original filename)
- Optional attributes array (e.g., metadata like publisher)
- Optional server, key, and secret overrides
Requirements: PHP >= 8.1
Removed features:
- Laravel ServiceProvider, Facade, and Eloquent Asset integration removed (stay on v1.x for Laravel projects)
- Database migration for Asset model no longer provided
- Eloquent Asset instance methods
getUrl()anddelete()removed sign(),isValid(), andfromConfig()methods removed; usesignParameters()andisValidParameters()instead
API Changes:
store()now takes a file path (string) orSplFileInfoobject directly, plus optional filename