php gaufrette,Easily use Gaufrette in your Symfony projects.

Gaufrette Bundle

68747470733a2f2f7472617669732d63692e6f72672f4b6e704c6162732f4b6e7047617566726574746542756e646c652e7376673f6272616e63683d6d6173746572

Provides a Gaufrette integration for your Symfony projects.

About Gaufrette

Gaufrette is a PHP 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 your project.

Note that, you need to install separately the adapters you want to use. You can find more details about these packages here,

and the full list adapters on packagist.

With composer

composer require knplabs/knp-gaufrette-bundle

Register the bundle

You must register the bundle in your kernel:

return [

// ...

Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],

];

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

# config/packages/knp_gaufrette.yaml

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

# config/packages/knp_gaufrette.yaml

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.

Use cases

Check out basic examples of the library.

Maintainers

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值