Easily use Gaufrette in your Symfony projects.
Go to file
Mathias STRASSER 0d52e63fe4 Merge pull request #144 from stephanvierkant/docs
Improved documentation
2017-01-19 10:00:11 +01:00
Command show correct message when 0 keys are available 2011-12-31 13:00:38 -05:00
DependencyInjection Merge pull request #102 from Karisch/feature/google-cloud-storage 2015-11-10 10:25:29 +01:00
Resources Improved documentation 2017-01-16 14:00:11 +01:00
Tests Add configuration for AclAmazonS3. Replaces #31 2013-02-22 17:29:35 +01:00
.gitignore Updated gitignore 2013-01-21 11:07:30 +01:00
.travis.yml allow sf3 2015-12-03 19:29:31 +01:00
composer.json Prepare for 0.3 2016-01-16 02:08:29 +02:00
FilesystemMap.php Reuse has method in FilesystemMap 2016-02-04 09:27:14 +02:00
KnpGaufretteBundle.php fix StreamWrapper not containing filesystems 2012-10-30 15:07:34 +01:00
LICENSE Initial commit 2011-05-12 00:46:28 +02:00
phpunit.xml.dist Added checking test coverage at tavisci 2012-09-05 20:31:58 +02:00
README.md Improved documentation 2017-01-16 14:00:11 +01:00
UPGRADE.md Add a not about upgrade from 0.2 to 0.3 2016-01-16 03:47:59 +02:00

Gaufrette Bundle

Build Status

Provides a Gaufrette integration for your Symfony projects.

About Gaufrette

Gaufrette is a PHP 5.3+ library providing a filesystem abstraction layer. This abstraction layer allows you to develop applications without needing to know where all their media files will be stored or how.

Documentation is available the official page of Gaufrette.

Installation

Prerequisites

As this bundle is an integration for Symfony of the Gaufrette library, it requires you to first install Gaufrette in a Symfony project.

With composer

This bundle can be installed using composer by adding the following in the require section of your composer.json file:

    "require": {
        ...
        "knplabs/knp-gaufrette-bundle": "~0.3"
    },

Register the bundle

You must register the bundle in your kernel:

<?php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(

        // ...

        new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle()
    );

    // ...
}

Configuration

The Gaufrette bundle allows you to declare your filesystems as services without having to reach into the famous "Service Container". Indeed, you can do it with the configuration!

The configuration of the Gaufrette bundle is divided into two parts: the adapters and the filesystems.

Configuring the Adapters

# app/config/config.yml
knp_gaufrette:
    adapters:
        foo:
            local:
                directory: /path/to/my/filesystem

The defined adapters are then used to create the filesystems.

You can use on of these adapters:

Configuring the Filesystems

# app/config/config.yml
knp_gaufrette:
    adapters:
        # ...
    filesystems:
        bar:
            adapter:    foo
            alias:      foo_filesystem

Each defined filesystem must have an adapter with its value set to an adapter's key. The filesystem defined above will result in a service with id gaufrette.bar_filesystem. The alias parameter allows us to define an alias for it (foo_filesystem in this case).

The filesystem map

You can access all declared filesystems through the map service. In the previous exemple, we declared a bar filesystem:

$container->get('knp_gaufrette.filesystem_map')->get('bar');

Returns the bar instance of Gaufrette\Filesystem.