Skip to content

CatLabInteractive/central-storage-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Central Storage Laravel Client

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.

Setup

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.

Installation

Central Storage provides a standard REST API and is consumable by any language or framework.

Install via composer:

composer require catlabinteractive/central-storage-client

Usage

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 SplFileInfo object 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

Version 2.0 Breaking Changes

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() and delete() removed
  • sign(), isValid(), and fromConfig() methods removed; use signParameters() and isValidParameters() instead

API Changes:

  • store() now takes a file path (string) or SplFileInfo object directly, plus optional filename

About

PHP client for central-storage.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages