A Symfony bundle that creates flysystem services based upon a url specified in the symfony configuration.
Using Composer add the bundle to your
dependencies using the require command:
composer require bravesheep/flysystem-url-bundle.
Add the bundle in your app/AppKernel.php. Note: in order for the
parameters defined by this bundle to be picked up by other bundles using
them you need to put it before those bundles. See below for more
information.
public function registerBundles()
{
return array(
// ...
new Bravesheep\FlysystemUrlBundle\BravesheepFlysystemUrlBundle(),
// ...
);
}For this bundle you need to configure which urls should be used and what
the service names should be for the generated services. An example
configuration is shown below where the media_fs_url parameter (which
you can put in your parameters.yml for example) generates a
flysystem adapter service for you to use.
bravesheep_flysystem_url:
urls:
# Generates media_fs_adapter.adapter service
media:
url: %media_fs_url%
prefix: media_fs_adapterSeveral url formats are accepted, a short overview of supported urls is shown below:
local:///path/to/directoryorfile:///path/to/directoryfor local filesystem storage. In case of local urls an absolute path is required. Use for example thekernel.root_dirparameter:file://%kernel.root_dir%/../web/media. Thelockquery parameter may be used to indicate different locking behavior:local:///path/to/directory?lock=false. Public file permissions may be set using thefile_permparameter:local:///path/to/directory?file_perm=0744. Similarly thefile_perm_private,dir_permanddir_perm_privateparameters are available.ftp://user:pass@host:port/path/to/dirfor FTP usage. Alternativelyftpsscheme may be used for SSL secured FTP.sftp://user:pass@host:port/path/to/dir?keyfile=path/to/keyfileor alternatively thesshscheme may be specified for the same behavior.dropbox://access_token:[email protected]for Dropbox access.s3://key:secret@region/bucketfor Amazon AWS S3. Alternatively theawss3andawss3v3schemes are available. For the v2 version of the AWS API you may useawss3v2as a scheme.null://or justnullmay be specified for a testing storage adapter which does not store anything.zip:///path/to/file.zipmay be used for local zip access.webdav://user:pass@host:port/path/to/dirmay be used for WebDAV access. Alternativelyhttp://user:pass@host:port/path/to/dirorhttps://user:pass@host:port/path/to/dirmay be used as well.
By default this bundle does not just create a flysystem adapter service but can also generate some extra parameters which you can directly use.
The bundle by default generates a parameter you can use in the OneupFlysystemBundle as a value for your adapter:
oneup_flysystem:
adapters:
media_adapter: %media_fs_adapter.oneup_adapter_params%By default the bundle also generates a public prefix url for some services if it can determine that url automatically. You could use this for example with the VichUploaderBundle:
vich_uploader:
mappings:
example:
upload_destination: media_fs
uri_prefix: %media_fs_adapter.public_url_prefix%If you don't need these parameters you can change them in the configuration of this bundle:
bravesheep_flysystem_url:
urls:
example:
url: %example_param%
prefix: example_fs_prefix
encoders: [] # In this case no parameter encoders are used, only the service is generated