remisirdata / l5-google-cloud-storage
Laravel 5 Flysystem Google Cloud Storage 服务提供者
2.1.1
2016-06-07 13:26 UTC
Requires
- illuminate/support: ~5.0.17|5.1.*|5.2.*
- superbalist/flysystem-google-storage: ^1.0
This package is not auto-updated.
Last update: 2024-09-14 19:09:29 UTC
README
将 superbalist/flysystem-google-storage 封装在一个 Laravel 5 / 5.1 兼容的服务提供者中。
配置
-
获取专用 CloudPlatform 服务账户的 p12 证书
-
在
config/app.php中添加服务提供者Websight\GcsProvider\CloudStorageServiceProvider::class,
-
在 config/filesystems.php 中添加一个磁盘
'gcs' => [ // Select the Google Cloud Storage Disk 'driver' => 'gcs', // The id of your new service account 'service_account' => 'service@account.iam.gserviceaccount.com', // The location of the json service account file 'service_account_json' => storage_path() . '/service_account.json', // The bucket you want this disk to point at (To change with your bucket name) 'bucket' => 'cloud-storage-bucket', ],
使用方法
像使用任何其他 Flysystem 适配器一样,通过 Storage-Facade 使用。
// Put a private file on the 'gcs' disk which is a Google Cloud Storage bucket Storage::disk('gcs')->put('test.png', file_get_contents(storage_path('/app/test.png'))); // Put a public-accessible file on the 'gcs' disk which is a Google Cloud Storage bucket Storage::disk('gcs')->put( 'test-public.png', file_get_contents(storage_path('/app/test-public.png')), \Illuminate\Contracts\Filesystem\Filesystem::VISIBILITY_PUBLIC ); // Retrieve a file $file = Storage::disk('gcs')->get('test.png');
许可证 (MIT)
版权 (c) 2016 websight GmbH
在此特此授予任何人免费获得本软件及其相关文档文件(“软件”)副本的权利,以无限制地处理该软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许获得软件副本的个人这样做,但受以下条件的约束
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
本软件按“原样”提供,不提供任何形式的保证,无论是明示的还是暗示的,包括但不限于适销性、特定用途的适用性和非侵权性。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论该责任是因合同、侵权或其他行为而引起的,以及该软件或其使用或其他处置。