knplabs/knp-gaufrette-bundle
Composer 安装命令:
composer require knplabs/knp-gaufrette-bundle
包简介
Allows to easily use the Gaufrette library in a Symfony project
README 文档
README
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:
<?php 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:
- Local Adapter
- Safe Local Adapter
- Service
- In Memory
- Azure Blob Storage
- GridFS
- MogileFS
- Ftp
- Sftp
- Phpseclib Sftp
- Apc
- AsyncAws S3
- AWS S3
- Open Cloud
- GoogleCloudStorage
- Cache
- Stream Wrapper
- Doctrine DBAL
- Dropbox
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
KNPLabs is looking for maintainers (see why).
If you are interested, feel free to open a PR to ask to be added as a maintainer.
We’ll be glad to hear from you :)
knplabs/knp-gaufrette-bundle 适用场景与选型建议
knplabs/knp-gaufrette-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29.94M 次下载、GitHub Stars 达 724, 最近一次更新时间为 2011 年 11 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「media」 「file」 「filesystem」 「abstraction」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 knplabs/knp-gaufrette-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 knplabs/knp-gaufrette-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 knplabs/knp-gaufrette-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
统计信息
- 总下载量: 29.94M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 735
- 点击次数: 19
- 依赖项目数: 98
- 推荐数: 20
其他信息
- 授权协议: MIT
- 更新时间: 2011-11-08