Git Product home page Git Product logo

knpgaufrettebundle's Introduction

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.4"
    },

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.

Maintainers

knpgaufrettebundle's People

Contributors

akovalyov avatar bocharsky-bw avatar caponica avatar docteurklein avatar gesthispania avatar havvg avatar herzult avatar l3l0 avatar lwagner avatar mbontemps avatar mtarvainen avatar mvhirsch avatar nicolasmure avatar nmpolo avatar ornicar avatar palleas avatar quingkhaos avatar radutopala avatar robinvdvleuten avatar romain-geissler avatar roukmoute avatar schmittjoh avatar silvioq avatar skigun avatar stephpy avatar teohhanhui avatar tgabi333 avatar tomis avatar vyacheslavk avatar zyphlar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.