Skip to content

Commit

Permalink
Merge pull request #56 from Relinks/refactor-laminas
Browse files Browse the repository at this point in the history
Refactor laminas
  • Loading branch information
basz authored Feb 19, 2020
2 parents 42c656d + ea14832 commit 1695969
Show file tree
Hide file tree
Showing 58 changed files with 121 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2019 Bushbaby Multimedia
Copyright (c) 2014-2020 Bushbaby Multimedia

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Copy the `config/bsb_flysystem.local.php.dist` to the `config/autoload` director
## Requirements

- \>=PHP7.2
- \>=ZF2.7
- \>=Laminas2.7

## Configuration

Expand All @@ -43,7 +43,7 @@ The configuration consists of the following base elements;
To configure an adapter you add a key to `bsb_flysystem->adapters` with a associative array containing the following options;

- type \<string\> Type of adapter
- shared \<boolean\> (optional) Defines the shared option of a [ZF2 service](http://framework.zend.com/manual/2.0/en/modules/zend.service-manager.quick-start.html#using-configuration).
- shared \<boolean\> (optional) Defines the shared option of a [Laminas service](https://docs.laminas.dev/laminas-servicemanager/configuring-the-service-manager/).
- options \<array\> Options specific per adapter (see [flysystem](http://flysystem.thephpleague.com) or config/bsb_flysystem.local.php.dist)


Expand Down Expand Up @@ -132,11 +132,11 @@ No cache factories are provided by BsbFlysystem. You should write them yourself
]
```

BsbFilesystem is able to automaticly wrap a ZF2 caching service in a in such way that a Flysystem instance is able to consume it.
BsbFilesystem is able to automaticly wrap a Laminas caching service in a in such way that a Flysystem instance is able to consume it.

This means that BsbFlysystem can work with both flysystem caches (implementing `League\Flysystem\Cached\CacheInterface`) and ZF2 caches (implementing `Zend\Cache\Storage\StorageInterface`).
This means that BsbFlysystem can work with both flysystem caches (implementing `League\Flysystem\Cached\CacheInterface`) and Laminas caches (implementing `Laminas\Cache\Storage\StorageInterface`).

example: caching options as are common in a ZF2 application
example: caching options as are common in a Laminas application

```
'bsb_flysystem' => [
Expand All @@ -158,18 +158,18 @@ example: caching options as are common in a ZF2 application
],
'service_manager' => [
'abstract_factories' => [
\Zend\Cache\Service\StorageCacheAbstractServiceFactory::class
\Laminas\Cache\Service\StorageCacheAbstractServiceFactory::class
],
],
```

Further reading in ZF2 [documentation](http://framework.zend.com/manual/current/en/modules/zend.mvc.services.html#zend-cache-service-storagecacheabstractservicefactory).
Further reading in Laminas [documentation](https://docs.laminas.dev/laminas-cache/storage/adapter/).

#### AdapterManager

The AdapterManager is automaticly configured, However it is possible to tweak its configuration via `bsb_flysystem->adapter_manager`.

In particular the lazy_services configuration key may be useful if you use the Rackspace Adapter. BsbFlysystem loads that adapter 'lazily'. A connection is only established until you actually use the adapter. This done with help from [ProxyManager](https://github.com/Ocramius/ProxyManager). As ZF2 also uses this libary we take advantage of the 'lazy_services' configuration that may be available in your application. The Rackspace adapter merges the ZF2 lazy_services config key with the adapter_manager lazy_services config allowing control over how the ProxyManager handles it's thing.
In particular the lazy_services configuration key may be useful if you use the Rackspace Adapter. BsbFlysystem loads that adapter 'lazily'. A connection is only established until you actually use the adapter. This done with help from [ProxyManager](https://github.com/Ocramius/ProxyManager). As Laminas also uses this libary we take advantage of the 'lazy_services' configuration that may be available in your application. The Rackspace adapter merges the Laminas lazy_services config key with the adapter_manager lazy_services config allowing control over how the ProxyManager handles it's thing.

```
'bsb_flysystem' => [
Expand All @@ -190,9 +190,9 @@ In particular the lazy_services configuration key may be useful if you use the R

## Usage

By default BsbFlysystem provides one pre-configured filesystem. This is a local filesystem (uncached) and exposes the data directory of a default ZF2 application.
By default BsbFlysystem provides one pre-configured filesystem. This is a local filesystem (uncached) and exposes the data directory of a default Laminas application.

Both the filesystems and adapters are ZF2 plugin managers and stored within the global service manager.
Both the filesystems and adapters are Laminas plugin managers and stored within the global service manager.

### Filesystem Manager

Expand Down Expand Up @@ -230,11 +230,11 @@ I have tried to provide factories (and tests) for each of the adapters that come
- Ftpd
- GoogleCloudDrive
- Local
- BsbFlysystem is preconfigured with an adapter named 'local_data' to expose the ./data directory of a ZF2 application.
- BsbFlysystem is preconfigured with an adapter named 'local_data' to expose the ./data directory of a Laminas application.
- Null
- Rackspace
- the ObjectStore Container must exist before usage
- Won't connect until actual usage by Filesystem (thanks to [ProxyManager](https://github.com/Ocramius/ProxyManager)) and uses the same lazy loading configuration ZF2 provides.
- Won't connect until actual usage by Filesystem (thanks to [ProxyManager](https://github.com/Ocramius/ProxyManager)) and uses the same lazy loading configuration Laminas provides.
- Replicate
- Sftp
- VFS
Expand All @@ -251,7 +251,7 @@ There is one FilesystemFactory which creates a Filesystem or EventableFilesystem

### Shared option and createOptions

A feature of ZF2 service managers is the ability to create an instance of a service each time you request it from the service manager (shared vs unshared). As a convienence this can be easily accomplished by setting 'shared' to false/true. Together with 'createOptions' that can be provided to the get method of a service manager this is useful to override option values.
A feature of Laminas service managers is the ability to create an instance of a service each time you request it from the service manager (shared vs unshared). As a convienence this can be easily accomplished by setting 'shared' to false/true. Together with 'createOptions' that can be provided to the get method of a service manager this is useful to override option values.

Consider the following configuration; Retrieve multiple configured dropbox filesystems based on stored accessTokens retrieved at runtime.

Expand Down Expand Up @@ -329,7 +329,7 @@ foreach ($contents as $entry) {

This class takes an `filesystem` constructor option which must implement `League\Flysystem\FilesystemInterface`.

The `BsbFlysystem\Filter\File\RenameUpload` extends `Zend\Filter\File\RenameUpload` class so I refer to the Flysystem [documentation](http://framework.zend.com/manual/current/en/modules/zend.filter.file.rename-upload.html#zend-filter-file-rename-upload) for more information.
The `BsbFlysystem\Filter\File\RenameUpload` extends `Laminas\Filter\File\RenameUpload` class so I refer to the Flysystem [documentation](http://framework.zend.com/manual/current/en/modules/zend.filter.file.rename-upload.html#zend-filter-file-rename-upload) for more information.

```
$request = new Request();
Expand Down
42 changes: 21 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "bushbaby/flysystem",
"description": "Zend Framework module bridge for flysystem filesystem.",
"description": "Laminas Framework module bridge for flysystem filesystem.",
"keywords": [
"filesystem",
"flysystem",
"zendframework",
"zend-expressive"
"laminas",
"mezzio"
],
"license": "MIT",
"type": "library",
Expand All @@ -17,10 +17,10 @@
],
"require": {
"php": "^7.2",
"laminas/laminas-cache": "^2.7",
"laminas/laminas-stdlib": "^2.2 || ^3.0",
"league/flysystem": "^1.0.41",
"psr/container": "^1.0",
"zendframework/zend-cache": "^2.7",
"zendframework/zend-stdlib": "^2.2 || ^3.0"
"psr/container": "^1.0"
},
"require-dev": {
"bushbaby/php-cs-fixer-config": "^1.0,>=1.0.5",
Expand All @@ -39,15 +39,15 @@
"phpunit/phpunit": "^7.5.17",
"spatie/flysystem-dropbox": "~1.0",
"superbalist/flysystem-google-storage": "^7.2",
"zendframework/zend-code": "^3.3.1",
"zendframework/zend-config": "^2.2 || ^3.0",
"zendframework/zend-filter": "^2.9.1",
"zendframework/zend-modulemanager": "^2.8 || ^3.0",
"zendframework/zend-mvc": "^2.8 || ^3.0",
"zendframework/zend-servicemanager": "^3.3"
"laminas/laminas-code": "^3.3.1",
"laminas/laminas-config": "^2.2 || ^3.0",
"laminas/laminas-filter": "^2.9.1",
"laminas/laminas-modulemanager": "^2.8 || ^3.0",
"laminas/laminas-mvc": "^2.8 || ^3.0",
"laminas/laminas-servicemanager": "^3.3"
},
"suggest": {
"zendframework/zend-filter": "zend-filter component ~2.8, if you need RenameUpload filter"
"laminas/laminas-filter": "laminas-filter component ~2.8, if you need RenameUpload filter"
},
"autoload": {
"psr-4": {
Expand All @@ -63,21 +63,21 @@
"branch-alias": {
"dev-master": "4.0.x-dev"
},
"zf": {
"laminas": {
"component": "BsbFlysystem",
"config-provider": "BsbFlysystem\\ConfigProvider"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"check": [
"@cs",
"@test"
"scripts": {
"check": [
"@cs",
"@test"
],
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff",
"test": "phpunit"
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff",
"test": "phpunit"
}
}
2 changes: 1 addition & 1 deletion config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Factory/AbstractAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand All @@ -20,12 +20,12 @@
namespace BsbFlysystem\Adapter\Factory;

use InvalidArgumentException;
use Laminas\Stdlib\ArrayUtils;
use League\Flysystem\AdapterInterface;
use ProxyManager\Configuration;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
use Psr\Container\ContainerInterface;
use Zend\Stdlib\ArrayUtils;

abstract class AbstractAdapterFactory
{
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/AwsS3v3AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/AzureAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/DropboxAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/FtpAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/FtpdAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/GoogleCloudDriveAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/LocalAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/RackspaceAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/ReplicateAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/SftpAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/VfsAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/WebDAVAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/ZipArchiveAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
4 changes: 2 additions & 2 deletions src/Cache/ZendStorageCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand All @@ -19,8 +19,8 @@

namespace BsbFlysystem\Cache;

use Laminas\Cache\Storage\StorageInterface;
use League\Flysystem\Cached\Storage\AbstractCache;
use Zend\Cache\Storage\StorageInterface;

/**
* Wrapper class that allows usage of a Zend Cache as a Flysystem Cache.
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RequirementsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @see https://bushbaby.nl/
*
* @copyright Copyright (c) 2014-2019 bushbaby multimedia. (https://bushbaby.nl)
* @copyright Copyright (c) 2014-2020 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <baskamer@gmail.com>
* @license MIT
*
Expand Down
Loading

0 comments on commit 1695969

Please sign in to comment.