PHPackages                             dotsunited/cabinet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. dotsunited/cabinet

ActiveLibrary[File &amp; Storage](/categories/file-storage)

dotsunited/cabinet
==================

Cabinet is a PHP 5.3+ library providing a simple file storage layer

v0.10.1(7y ago)172.0k1BSD-3-ClausePHPPHP &gt;=5.3.0

Since Feb 28Pushed 7y ago9 watchersCompare

[ Source](https://github.com/dotsunited/Cabinet)[ Packagist](https://packagist.org/packages/dotsunited/cabinet)[ Docs](https://github.com/dotsunited/Cabinet)[ RSS](/packages/dotsunited-cabinet/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Cabinet
=======

[](#cabinet)

[![Build Status](https://camo.githubusercontent.com/251026ce9cc3364b5c280d76b35a55310ee7731e804e673f6d540c0393e57cc8/68747470733a2f2f7472617669732d63692e6f72672f646f7473756e697465642f436162696e65742e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/dotsunited/Cabinet)

Cabinet is a PHP 5.3+ library providing a simple file storage layer.

It provides a unified API for storing and retrieving files as well as getting basic informations like size and content type of a file.

This is useful if

- you want to write reusable components with a configurable file storage backend
- you want to ensure scalability for your file storage (You can for example start storing your files on your servers filesystem and switch later to Amazon S3)

Cabinet offers adapters for [PHP streams](http://php.net/stream) and [Amazon S3](https://s3.amazonaws.com) out of the box. But you can easily write your own adapters by implementing `DotsUnited\Cabinet\Adapter\AdapterInterface`.

Installation
------------

[](#installation)

Cabinet can be installed using the [Composer](http://packagist.org) tool. You can either add `dotsunited/cabinet` to the dependencies in your composer.json, or if you want to install Cabinet as standalone, go to the main directory and run:

```
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
```

You can then use the composer-generated autoloader to access the Cabinet classes:

```

```

Usage
-----

[](#usage)

Instances of Cabinet adapters can be either created directly or using the static `DotsUnited\Cabinet\Cabinet::factory()` method.

### Using a Cabinet Adapter constructor

[](#using-a-cabinet-adapter-constructor)

You can create an instance of an adapter using its constructor. An adapter constructor takes one argument, which is an array of configuration parameters.

```
