Added Laravel project

This commit is contained in:
2017-09-17 00:35:10 +02:00
parent a3c19304d5
commit ecf605b8f5
6246 changed files with 682270 additions and 2 deletions

View File

@@ -0,0 +1,55 @@
---
layout: default
permalink: /adapter/aws-s3-v2/
title: Aws S3 Adapter V2
---
# Aws S3 Adapter - SDK V2
## Installation
~~~ bash
composer require league/flysystem-aws-s3-v2
~~~
## Usage
~~~ php
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v2\AwsS3Adapter;
use League\Flysystem\Filesystem;
$client = S3Client::factory([
'key' => '[your key]',
'secret' => '[your secret]',
'region' => '[aws-region]',
]);
$adapter = new AwsS3Adapter($client, 'bucket-name', 'optional/path/prefix');
$filesystem = new Filesystem($adapter);
~~~
To enable [reduced redunancy storage](http://aws.amazon.com/s3/details/#RRS) set up your adapter like so:
~~~ php
$adapter = new AwsS3Adapter($client, 'bucket-name', 'optional/path/prefix', [
'StorageClass' => 'REDUCED_REDUNDANCY',
]);
~~~
### Compatible storage protocols
If you're using a storage service which implements the S3 protocols, you can set the `base_url` configuration option when constructing the client.
~~~ php
$client = S3Client::factory([
'base_url' => 'http://some.other.endpoint',
// ... other settings
]);
~~~
Known compliant storage providers are:
* [Google Cloud Storage](https://cloud.google.com/storage/docs/migrating#migration-simple)
* Know more? Please submit a PR!

View File

@@ -0,0 +1,32 @@
---
layout: default
permalink: /adapter/aws-s3-v3/
title: Aws S3 Adapter V3
---
# Aws S3 Adapter - SDK V3
## Installation
~~~ bash
composer require league/flysystem-aws-s3-v3
~~~
## Usage
~~~ php
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
$client = S3Client::factory([
'credentials' => [
'key' => 'your-key',
'secret' => 'your-secret',
],
'region' => 'your-region',
'version' => 'latest|version',
]);
$adapter = new AwsS3Adapter($client, 'your-bucket-name', 'optional/path/prefix');
~~~

View File

@@ -0,0 +1,31 @@
---
layout: default
permalink: /adapter/azure/
title: Azure Blob Storage
---
# Azure Blob Storage
## Installation
~~~ bash
composer require league/flysystem-azure
~~~
## Usage
~~~ php
use WindowsAzure\Common\ServicesBuilder;
use League\Flysystem\Filesystem;
use League\Flysystem\Azure\AzureAdapter;
$endpoint = sprintf(
'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s',
'account-name',
'api-key'
);
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($endpoint);
$filesystem = new Filesystem(new AzureAdapter($blobRestProxy, 'my-container'));
~~~

View File

@@ -0,0 +1,24 @@
---
layout: default
permalink: /adapter/copy/
title: Copy.com Adapter
---
# Copy.com Adapter
## Installation
~~~ bash
composer require league/flysystem-copy
~~~
## Usage
~~~ php
use Barracuda\Copy\API;
use League\Flysystem\Filesystem;
use League\Flysystem\Copy\CopyAdapter;
$client = new API($consumerKey, $consumerSecret, $accessToken, $tokenSecret);
$filesystem = new Filesystem(new CopyAdapter($client, 'optional/path/prefix'));
~~~

View File

@@ -0,0 +1,29 @@
---
layout: default
permalink: /adapter/dropbox/
title: Dropbox Adapter
---
# Dropbox Adapter
## Installation
~~~ bash
composer require spatie/flysystem-dropbox
~~~
## Usage
A token can be generated in the [App Console](https://www.dropbox.com/developers/apps) for any Dropbox API app. You'll find more info at [the Dropbox Developer Blog](https://blogs.dropbox.com/developers/2014/05/generate-an-access-token-for-your-own-account/).
~~~ php
use League\Flysystem\Filesystem;
use Spatie\Dropbox\Client;
use Spatie\FlysystemDropbox\DropboxAdapter;
$client = new Client($authorizationToken);
$adapter = new DropboxAdapter($client);
$filesystem = new Filesystem($adapter);
~~~

View File

@@ -0,0 +1,31 @@
---
layout: default
permalink: /adapter/ftp/
title: FTP Adapter
---
# FTP Adapter
## Installation
Comes with the main Flysystem package.
## Usage
~~~ php
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Ftp as Adapter;
$filesystem = new Filesystem(new Adapter([
'host' => 'ftp.example.com',
'username' => 'username',
'password' => 'password',
/** optional config settings */
'port' => 21,
'root' => '/path/to/root',
'passive' => true,
'ssl' => true,
'timeout' => 30,
]));
~~~

View File

@@ -0,0 +1,26 @@
---
layout: default
permalink: /adapter/gridfs/
title: GridFS Adapter
---
# GridFS Adapter
## Installation
~~~ bash
composer require league/flysystem-gridfs
~~~
## Usage
~~~ php
use League\Flysystem\GridFS\GridFSAdapter;
use League\Flysystem\Filesystem;
$mongoClient = new MongoClient();
$gridFs = $mongoClient->selectDB('db_name')->getGridFS();
$adapter = new GridFSAdapter($gridFs);
$filesystem = new Filesystem($adapter);
~~~

View File

@@ -0,0 +1,62 @@
---
layout: default
permalink: /adapter/local/
title: Local Adapter
---
# Local Adapter
## Installation
Comes with the main Flysystem package.
## Usage
~~~ php
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
$adapter = new Local(__DIR__.'/path/to/root');
$filesystem = new Filesystem($adapter);
~~~
## Locks
By default this adapter uses a lock during writes
and updates. This behaviour can be altered using the
second constructor argument.
~~~ php
$adapter = new Local(__DIR__.'/path/to/too', 0);
~~~
## Links [added in 1.0.8]
The Local adapter doesn't support links, this violates
the root path constraint which is enforced throughout
Flysystem. By default, when links are encountered an
exception is thrown. This behaviour can be altered
using the third constructor argument.
~~~ php
// Skip links
$adapter = new Local(__DIR__.'/path/to/too', LOCK_EX, Local::SKIP_LINKS);
// Throw exceptions (default)
$adapter = new Local(__DIR__.'/path/to/too', LOCK_EX, Local::DISALLOW_LINKS);
~~~
## File and directory permission settings [added in 1.0.14]
~~~ php
$adapter = new Local(__DIR__.'/path/to/too', LOCK_EX, Local::DISALLOW_LINKS, [
'file' => [
'public' => 0744,
'private' => 0700,
],
'dir' => [
'public' => 0755,
'private' => 0700,
]
]);
~~~

View File

@@ -0,0 +1,24 @@
---
layout: default
permalink: /adapter/memory/
title: Memory Adapter
---
# Memory Adapter
This adapter keeps the filesystem completely in memory. This is useful when you need a filesystem, but don't want it persisted.
## Installation
~~~ bash
composer require league/flysystem-memory
~~~
## Usage
~~~ php
use League\Flysystem\Filesystem;
use League\Flysystem\Memory\MemoryAdapter;
$filesystem = new Filesystem(new MemoryAdapter());
~~~

View File

@@ -0,0 +1,20 @@
---
layout: default
permalink: /adapter/null-test/
title: Null Adapter
---
# Null Adapter
## Installation
Comes with the main Flysystem package.
## Usage
Acts like `/dev/null`
~~~ php
$adapter = new League\Flysystem\Adapter\NullAdapter;
$filesystem = new League\Flysystem\Filesystem($adapter);
~~~

View File

@@ -0,0 +1,48 @@
---
layout: default
permalink: /adapter/phpcr/
title: PHPCR Adapter
---
# PHPCR Adapter
This adapter works with any [PHPCR](http://phpcr.github.io) implementation.
Choose the one that fits your needs and add it to your project, or composer
will complain that you miss `phpcr/phpcr-implementation`. See
[this article](http://symfony.com/doc/master/cmf/cookbook/database/choosing_phpcr_implementation.html)
for more on choosing your implementation.
## Installation
Assuming you go with jackalope-doctrine-dbal, do:
~~~bash
composer require jackalope/jackalope-doctrine-dbal league/flysystem-phpcr
~~~
## Usage
Bootstrap your PHPCR implementation. If you chose jackalope-doctrine-dbal with sqlite,
this will look like this for example:
~~~php
use League\Flysystem\Filesystem;
use League\Flysystem\Phpcr\PhpcrAdapter;
use Jackalope\RepositoryFactoryDoctrineDBAL;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\DriverManager;
$connection = DriverManager::getConnection([
'driver' => 'pdo_sqlite',
'path' => '/path/to/sqlite.db',
]);
$factory = new RepositoryFactoryDoctrineDBAL();
$repository = $factory->getRepository([
'jackalope.doctrine_dbal_connection' => $connection,
]);
$session = $repository->login(new SimpleCredentials('', ''));
// this part looks the same regardless of your phpcr implementation.
$root = '/flysystem_tests';
$filesystem = new Filesystem(new PhpcrAdapter($session, $root));
~~~

View File

@@ -0,0 +1,32 @@
---
layout: default
permalink: /adapter/rackspace/
title: Rackspace Adapter
---
# Rackspace Adapter
## Installation
~~~ bash
composer require league/flysystem-rackspace
~~~
## Usage
~~~ php
use OpenCloud\OpenStack;
use OpenCloud\Rackspace;
use League\Flysystem\Filesystem;
use League\Flysystem\Rackspace\RackspaceAdapter;
$client = new OpenStack(Rackspace::UK_IDENTITY_ENDPOINT, [
'username' => ':username',
'password' => ':password',
]);
$store = $client->objectStoreService('cloudFiles', 'LON');
$container = $store->getContainer('flysystem');
$filesystem = new Filesystem(new RackspaceAdapter($container, 'optional/path/prefix'));
~~~

View File

@@ -0,0 +1,23 @@
---
layout: default
permalink: /adapter/replicate/
title: Replicate Adapter
---
# Replicate Adapter
## Installation
~~~ bash
composer require league/flysystem-replicate-adapter
~~~
## Usage
The `ReplicateAdapter` facilitates smooth transitions between adapters, allowing an application to stay functional and migrate its files from one adapter to another. The adapter takes two other adapters, a source and a replica. Every change is delegated to both adapters, while all the read operations are passed onto the source only.
~~~ php
$source = new League\Flysystem\AwsS3V3\AwsS3Adapter(...);
$replica = new League\Flysystem\Adapter\Local(...);
$adapter = new League\Flysystem\Replicate\ReplicateAdapter($source, $replica);
~~~

View File

@@ -0,0 +1,30 @@
---
layout: default
permalink: /adapter/sftp/
title: SFTP Adapter
---
# SFTP Adapter
## Installation
~~~ bash
composer require league/flysystem-sftp
~~~
## Usage
~~~ php
use League\Flysystem\Filesystem;
use League\Flysystem\Sftp\SftpAdapter;
$filesystem = new Filesystem(new SftpAdapter([
'host' => 'example.com',
'port' => 21,
'username' => 'username',
'password' => 'password',
'privateKey' => 'path/to/or/contents/of/privatekey',
'root' => '/path/to/root',
'timeout' => 10,
]));
~~~

View File

@@ -0,0 +1,21 @@
---
layout: default
permalink: /adapter/webdav/
title: WebDAV Adapter
---
# WebDAV Adapter
## Installation
~~~ bash
composer require league/flysystem-webdav
~~~
## Usage
~~~ php
$client = new Sabre\DAV\Client($settings);
$adapter = new League\Flysystem\WebDAV\WebDAVAdapter($client, 'optional/path/prefix');
$flysystem = new League\Flysystem\Filesystem($adapter);
~~~

View File

@@ -0,0 +1,30 @@
---
layout: default
permalink: /adapter/zip-archive/
title: ZipArchive Adapter
---
# ZipArchive Adapter
## Installation
~~~ bash
composer require league/flysystem-ziparchive
~~~
## Usage
~~~ php
use League\Flysystem\Filesystem;
use League\Flysystem\ZipArchive\ZipArchiveAdapter;
$filesystem = new Filesystem(new ZipArchiveAdapter(__DIR__.'/path/to/archive.zip'));
~~~
### Force Save
When creating a new zip file it will only be saved at the end of the PHP request because the ZipArchive library relies on an internal `__destruct` method to be called. You can force the saving of the zip file before the end of the request by calling the `close` method on the archive through the adapter.
~~~ php
$filesystem->getAdapter()->getArchive()->close();
~~~