Skip to content

Commit 2068289

Browse files
First release
0 parents  commit 2068289

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Tavux <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "tavux/laravel-ibm-cos",
3+
"license": "MIT",
4+
"description": "Laravel Custom Filesystem for IBM Cloud Object Storage",
5+
"version": "0.0.1",
6+
"homepage": "https://github.com/tavux/laravel-ibm-cos",
7+
"authors": [
8+
{
9+
"name": "TAVUX",
10+
"homepage": "https://tavux.tech",
11+
"email": "[email protected]"
12+
}
13+
],
14+
"require": {
15+
"php": ">=5.6.0",
16+
"tavux/flysystem-ibm-cos": "1.0.0"
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"Tavux\\IBMCloudObjectStorage\\Laravel\\": "src/"
21+
}
22+
},
23+
"extra": {
24+
}
25+
}

config/filesystems.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
return [
4+
'ibm-cos' => [
5+
'driver' => 's3',
6+
'key' => env('IBM_COS_ACCESS_KEY_ID'),
7+
'secret' => env('IBM_COS_SECRET_ACCESS_KEY'),
8+
'region' => env('IBM_COS_DEFAULT_REGION'),
9+
'bucket' => env('IBM_COS_BUCKET'),
10+
'endpoint' => env('IBM_COS_ENDPOINT'),
11+
],
12+
];
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\Facades\Storage;
6+
use Illuminate\Support\ServiceProvider;
7+
use League\Flysystem\Filesystem;
8+
use Tavux\Flysystem\IBMCloudObjectStorage\IbmCosAdapter;
9+
10+
class IbmCloudObjectStorageProvider extends ServiceProvider
11+
{
12+
/**
13+
* Register services.
14+
*
15+
* @return void
16+
*/
17+
public function register()
18+
{
19+
$this->mergeConfigFrom(
20+
__DIR__ . '/../config/filesystems.php',
21+
'filesystems.disks'
22+
);
23+
}
24+
25+
/**
26+
* Bootstrap services.
27+
*
28+
* @return void
29+
*/
30+
public function boot()
31+
{
32+
Storage::extend('ibm-cos', function($app, $config) {
33+
return new Filesystem(new IbmCosAdapter($config, $config['bucket']));
34+
});
35+
}
36+
}

0 commit comments

Comments
 (0)