live-controls/storage
最新稳定版本:v1.4.1
Composer 安装命令:
composer require live-controls/storage
包简介
Object Storage Library for live-controls
README 文档
README
Object Storage Library for live-controls
Requirements
- PHP 8.0+
- S3 compatible Object Storage Hoster like Contabo or DigitalOcean
Translations
None
Installation
composer require live-controls/storage
Setup FluentObjectStorageHandler
- If you want to use DBDisks, create the migration like this:
php artisan vendor:publish --provider="LiveControls\Storage\StorageServiceProvider" --tag="migrations"
Setup ObjectStorageHandler
- Add to .env:
OBJECTSTORAGE_ACCESS_KEY_ID=53234123 //Should be the access key id to the storage
OBJECTSTORAGE_SECRET_ACCESS_KEY=0000000 //Should be the secret access key to the storage
OBJECTSTORAGE_DEFAULT_REGION=usc1 //Should match the subdomain in endpoint or url
OBJECTSTORAGE_BUCKET=bucketName //The name of the bucket
OBJECTSTORAGE_URL=https://usc1.contabostorage.com/1234567890:bucketName //The url of the bucket
OBJECTSTORAGE_ENDPOINT=https://usc1.contabostorage.com/ //The endpoint of the bucket
OBJECTSTORAGE_USE_PATH_STYLE_ENDPOINT=true //Needs to be true to work!
- Add to config/filesystems.php:
'disks' => [ ... 'objectstorage' => [ 'driver' => 's3', 'key' => env('OBJECTSTORAGE_ACCESS_KEY_ID'), 'secret' => env('OBJECTSTORAGE_SECRET_ACCESS_KEY'), 'region' => env('OBJECTSTORAGE_DEFAULT_REGION'), 'bucket' => env('OBJECTSTORAGE_BUCKET'), 'url' => env('OBJECTSTORAGE_URL'), 'endpoint' => env('OBJECTSTORAGE_ENDPOINT'), 'use_path_style_endpoint' => env('OBJECTSTORAGE_USE_PATH_STYLE_ENDPOINT', false), 'throw' => false, ], ]
- Publish configuration file with:
php artisan vendor:publish --tag="livecontrols.storage.config"
- Set "storage:disk" to the name of your disk set in Step 2
Usage
Todo
Hint
- To use it with big files, use fopen($fName, 'r+') and not file_get_contents($fName)
- If you, for whatever reason, need to change the directory separator to something else than a forwards slash, change the "directory_separator" inside the configuration file. But you normally wouldn't want to do this, because it would break the temporaryUrl return value.
统计信息
- 总下载量: 2.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-07-22