定制 bnet/bnrepos 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bnet/bnrepos

Composer 安装命令:

composer require bnet/bnrepos

包简介

lazy PHP5 library that provides Repositories as filesystem abstraction layer

README 文档

README

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

Getting Started

1. Create Config File (Local Dirs, FTP, SFTP, S3)

# repositories.yml
bnrepo-test:
 - type: local
 - dir: /tmp

2. Import Configuration for your Repositories

  RepositoryManager::importRepositoriesFromYamlFile('repositories.yml');

3. Get the Repository from the RepositoryManager

  $repo = RepositoryManager::getRepository('bnrepo-test');

4. Read/Write/Download/Upload Data/Files

  $repo->write('test.txt', 'Hello World');
  echo $repo->read('test.txt') // prints Hello World

Documentation

Configuration

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

Load the Configuration

  RepositoryManager::importRepositoriesFromYamlFile('repositories.yml');

Use the Repositories

  $repo = RepositoryManager::getRepository('bnrepo-test');

Every Repository is an \Gaufrette\Filesystem, so check out there docs too.

Running the Tests

The tests use PHPUnit.

Setup the vendor libraries

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.

Launch the Test Suite

$ phpunit

Is it green?

统计信息

  • 总下载量: 332
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-04-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固