Skip to content

Configuration

pavel edited this page Mar 17, 2018 · 1 revision

Configuration files are included in the package, but you can easily redefine any options upon creating storage instance. To do this you have to pass array of options to the storage class constructor. See examples below.

Local filesystem storage

Check out configuration file options. Each option in the file is well commented and won't be duplicated in this article.

Example to override the default options in the configuration file:

$config = [
    'security' => [
        'readOnly' => true,
        'extensions' => [
            'policy' => 'ALLOW_LIST',
            'restrictions' => [
                'jpg',
                'jpe',
                'jpeg',
                'gif',
                'png',
                'html',
            ],
        ],
    ],
];

$local = new \RFM\Repository\Local\Storage($config);

AWS S3 storage

Check out configuration file options.

Most of the configurations options for AWS S3 storage are the same as for Local filesystem storage, and come from config.local.php file.

Note that according to default configuration image thumbnails will be stored at the AWS S3 storage along with other files. This example demonstrates how to change this behavior and store thumbnails to the "s3_thumbs" directory at the local storage:

$config_s3 = [
    'images' => [
        'thumbnail' => [
            'dir' => 's3_thumbs',
            'useLocalStorage' => true,
        ],
    ],
    'credentials' => [
        'region' => 'your region',
        'bucket' => 'your aws s3 bucket',
        'endpoint' => null,
        'credentials' => [
            'key' => 'your aws s3 key',
            'secret' => 'your aws s3 secret',
        ],
        'options' => [
            'use_path_style_endpoint' => false,
        ],
        'defaultAcl' => \RFM\Repository\S3\StorageHelper::ACL_PUBLIC_READ,
        'debug' => false,
    ],
];

$s3 = new \RFM\Repository\S3\Storage($config_s3);
Clone this wiki locally