PHPackages                             district5/slim-psr-upload-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. district5/slim-psr-upload-handler

ActiveLibrary[File &amp; Storage](/categories/file-storage)

district5/slim-psr-upload-handler
=================================

An easy to use, provider based upload handler, for Slim Framework.

1.0.1(2y ago)06mitPHPPHP &gt;=8.1

Since Mar 6Pushed 1y agoCompare

[ Source](https://github.com/district-5/php-slim-psr-upload-handler)[ Packagist](https://packagist.org/packages/district5/slim-psr-upload-handler)[ Docs](https://github.com/district-5/php-slim-psr-upload-handler)[ RSS](/packages/district5-slim-psr-upload-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

District5 - Slim Framework PSR Upload Handler
=============================================

[](#district5---slim-framework-psr-upload-handler)

### Introduction...

[](#introduction)

This is a simple upload handler for Slim Framework. It is designed to be used with the PSR interfaces and is compatible with Slim 4.

Providers cover the following: Google Cloud Storage, AWS S3, and local files.

Simply install with:

```
composer require district5/slim-psr-upload-handler
```

### Supported Providers...

[](#supported-providers)

- Local File (Key: `local`)
    - This provider will save the file to a local directory.
    - Configuration:
        - `path` (string) - The directory to save the file to.
        - `overwrite` (bool) - Overwrite the file if it already exists.
        - `appendRandom` (bool) - Append a random string to the file name.
        - `suppressExceptions` (bool) - Ignore errors and return the UploadedDto object regardless. Overrides the **global**`suppressExceptions` option.
- Google Cloud Storage (Key: `gcs`)
    - This provider will save the file to Google Cloud Storage.
    - Configuration:
        - `projectId` (string) - The Google Cloud project id.
        - `bucket` (string) - Your Google Cloud Storage bucket name.
        - `path` (string) - The path within to bucket the file, for example 'uploads' or 'images'. Leave empty (or null) for root.
        - `keyFile` (array) - The JSON decoded (ie, array) version of service account key file.
        - `overwrite` (bool) - Overwrite the file if it already exists.
        - `appendRandom` (bool) - Append a random string to the file name.
        - `acl` (string) - The Google Cloud Storage object ACL.
        - `suppressExceptions` (bool) - Ignore errors and return the UploadedDto object regardless. Overrides the **global**`suppressExceptions` option.
- AWS S3 (Key: `s3`)
    - This provider will save the file to Amazon S3.
    - Configuration:
        - `region` (string) - The region of the bucket.
        - `version` (string) - The version of the S3 API to use.
        - `bucket` (string) - The name of the bucket.
        - `path` (string) - The path within to bucket the file, for example 'uploads' or 'images'. Leave empty (or null) for root.
        - `accessKey` (string) - The access key for the bucket.
        - `secretKey` (string) - The secret key for the bucket.
        - `overwrite` (bool) - Overwrite the file if it already exists.
        - `appendRandom` (bool) - Append a random string to the file name.
        - `acl` (string) - The ACL for the object (public-read, private, etc.).
        - `suppressExceptions` (bool) - Ignore errors and return the UploadedDto object regardless. Overrides the **global**`suppressExceptions` option.

### Usage...

[](#usage)

```
