Simple Factory for the League\Flysystem filesystem abstraction library.
- Provide a simpler way of creating the different adapters based on a configuration file.
- Add validations to the config file.
- Add Validation to the different adapters.
Add the following lines to your composer.json:
{
"require": {
"Westwing-Home-and-Living/flysystem-factory": "v0.2"
},
"repositories": [
{
"type": "vcs",
"url": "git@github.com:Westwing-Home-and-Living/flysystem-factory.git"
}
]
}
Note: Modify the version accordingly
Want to get started quickly? Check out the Recipes folder!
- Zend Framework 1
Adapters currently implemented:
- Local
- Ftp
- AwsS3
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Westwing\Filesystem\Factory;
use Symfony\Component\Yaml\Yaml;
$config = Yaml::parse(file_get_contents(__DIR__ . 'filesystem.yml'));
$fileSystemFactory = new Factory();
$fileSystemFactory->setConfig($config);
$fileSystem = $fileSystemFactory->get('localFS');
print_r($fileSystem->listContents());
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Westwing\Filesystem\Factory;
$fileSystemFactory = new Factory();
$fileSystemFactory->setConfigFile(__DIR__ . 'filesystem.yml');
$fileSystem = $fileSystemFactory->get('localFS');
print_r($fileSystem->listContents());
Filesystem:
adapter:
localFS:
type: "Local"
root: "."
sharedFS:
type: "AwsS3"
key:
secret:
region:
bucket:
prefix:
options:
Body:
ContentType:
ContentLength: