BNRepo is a PHP5 library based on Gaufrette, that provides different Repositories for filesystem abstraction.
The RepositoryManager is lazy - no actions or objects before the first use
# repositories.yml
bnrepo-test:
- type: local
- dir: /tmp
RepositoryManager::importRepositoriesFromYamlFile('repositories.yml');
$repo = RepositoryManager::getRepository('bnrepo-test');
$repo->write('test.txt', 'Hello World');
echo $repo->read('test.txt') // prints Hello World
Setup your ConfigFile repositories.yml:
bnrepo-test-local:
type: local
dir: /tmp/bnrepo-test
create: true
bnrepo-test-s3:
type: s3
aws_key: AWS_KEY
aws_secret: AWS_SECRET
bucket: bnrepo-test
dir: bnrepo-test
create: true
use_old_version: true
options:
default_acl: public-read #DEFAULT is only BucketOwner can read, so everyone with the link can read
bnrepo-test-ftp:
type: ftp
host: HOST
username: USERNAME
password: PASSWORD
dir: /bnrepo-test
passive: false
bnrepo-test-sftp:
type: sftp
host: HOST
port: PORT
dir: /bnrepo-test
username: USERNAME
password: PASSWORD
RepositoryManager::importRepositoriesFromYamlFile('repositories.yml');
$repo = RepositoryManager::getRepository('bnrepo-test');
Every Repository is an \Gaufrette\Filesystem, so check out there docs too.
The tests use PHPUnit.
As some filesystem adapters use vendor libraries, you should install the vendors:
$ cd BNRepo
$ php composer.phar install
Implement the configurations for the repositories you want to test and remove the -DISABLED postfix. Without Configuration the hole AdapterTest would skipped.
$ phpunit
Is it green?