Skip to content

Latest commit

 

History

History
116 lines (73 loc) · 3.83 KB

File metadata and controls

116 lines (73 loc) · 3.83 KB

Storage service

image

App endpoints

Path Method Scheme Grant
/api/user/{userId}/storage/folders POST ANY ALL
/api/user/{userId}/storage/files POST ANY ALL
/api/user/{userId}/storage/files GET ANY ALL
/api/user/{userId}/storage/files DELETE ANY ALL

Admin endpoints

Path Method Scheme Grant
/api/admin/user/{userId}/storage/files GET ANY ALL
/api/admin/user/{userId}/storage/files/{id} GET ANY ALL

Configuration

Add docker machine IP to /etc/hosts:

127.0.0.1 storage.test

Requirements

  • PHP 7.4
  • Lumen
  • Redis

Adapters

Name Class
drop-box \DropBoxAdapter::class
aws \AwsAdapter::class
in-memory \InMemoryAdapter::class
file-storage \FileStorageAdapter::class
google-drive \GoogleDriveAdapter::class

Your self Adapter

If you did not find the adapter hat you need in the list, you can easy implement it yourself. To do this, you need to:

  1. create a file /Infrastructure/Adapters/XXXAdapter.php, where XXX it is the name of your new adapter
  2. XXXAdapter should be inherit from the interface StorageInterface

For use your new adapter just update APP_ADAPTERS=XXX key in .env file.

Enjoy it!

File Storage Adapter

You need to give a permission to storage dir:

sudo chmod -R 777 ./code/storage

Google Drive Adapter

PHP Quickstart - complete the steps described in the rest of this page to create a simple PHP command-line application that makes requests to the Drive API.

Create your Google Drive API keys. Here a detailed information on how to obtain your API ID, secret and refresh token:

You also need to give a permission to resource dir:

sudo chmod -R 777 ./code/resources

S3 Adapter

Getting Started with the AWS SDK for PHP - this guide shows you how to start building PHP applications on the Amazon Web Services platform with the AWS SDK for PHP.

You also need to to create a Bucket and make sure that your bucket is configured for clients to set a public-accessible ACL.

DropBox Adapter

Community SDKs - the guide to implementation of Dropbox API.

To start working with the Dropbox API, you'll need an App. You can create a new app for the Dropbox API here

Clean code

make pre-commit

Ressources:

Dropbox develop apps

Dropbox Community SDKs

Drive API > PHP Quickstart

Laravel google drive demo

Nginx content caching

Author

Dykyi Roman, e-mail: [email protected]