Flexible storage solution for end-user data

v1.3.0 2015-05-09 10:39 UTC

This package is auto-updated.

Last update: 2022-11-21 18:10:21 UTC


Flexible storage solution for end-user data.


Check out our blogpost to see how we're using it in production:


Check out composer for details about installing and running composer.

Then, add linkorb/filespace to your project's composer.json:

    "require": {
        "linkorb/filespace": "~1.0"


use Aws\S3\S3Client;
use FileSpace\Service\PdoService;
use ObjectStorage\Adapter\S3Adapter;

// Instantiate an S3 connection
$s3client = S3Client::factory(array(
    'key' => 'my_s3_key',
    'secret' => 'my_s3_secret'

// Get a storage adapter based on the s3 client
$storage = new S3Adapter($s3client, 'my-bucket-name', 'my/key/prefix/');

// Get a PDO connection
$pdo = ... // TODO;

// Instantiate the File Space Service:
$service = new PdoFileSpaceService($pdo, $storage);

// test if a 'space' has been created:
$space_key = '';
if (!$service->hasSpace($space_key)) {
    $service->createSpace($space_key, "Customer 1: John Johnson");
$space = $service->getSpace($space_key);

// List all files in the space
$files = $service->getFiles($space);
foreach ($files as $file) {
    echo $file->getKey() . ': ' . $file->getSizeOriginalDisplay() . "\n";

// Upload a file into this space
$service->upload($space, 'contract-final.pdf', '/home/john/Downloads/contract.pdf');

// Download a file from this space:
$service->download($space, 'invoice-1234.pdf', '/home/john/invoices/invoice-1234.pdf');

// Delete a file from the space:
$service->deleteFile($space, 'remove-me.txt');

Initializing the database schema

vendor/bin/database-manager database:loadschema --apply filespace example/schema.xml


Ready to build and improve on this repo? Excellent! Go ahead and fork/clone this repo and we're looking forward to your pull requests!

If you are unable to implement changes you like yourself, don't hesitate to open a new issue report so that we or others may take care of it.

Brought to you by the LinkORB Engineering team

Check out our other projects at

Btw, we're hiring!


Please check for full license information