library aliyun-oss-php-sdk-laravel
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
aliyuncs/aliyun-oss-php-sdk-laravel
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
- Tuesday, September 5, 2017
- by hefei19861
- Repository
- 8 Watchers
- 49 Stars
- 4,098 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 3 Forks
- 2 Open issues
- 5 Versions
- 84 % Grown
AliCloud OSS Service Provider for Laravel 5
, (*1)
Make a Reference in Your Laravel Project
- Install the Laravel framework or the Lumen framework.
- Create a Laravel or Lumen project, depending on the framework you have installed.
-
In the composer.json file of the new project, insert the following code:, (*2)
{
"require": {
"aliyuncs/aliyun-oss-php-sdk-laravel": "~1.2.0"
}
}
-
Run the following command: composer update, (*3)
For the Laravel Project
-
Edit the vendor/aliyun-oss/aliyun-oss-php-sdk-laravel/config/config.php file as follows:, (*4)
return [
'id' => 'your id',
'key' => 'your key',
'endpoint' => 'your endpoint',
'bucket' => 'your bucket'
];
-
Edit the config/app.php file and register OSS Service Provider:, (*5)
'providers' => array(
// ...
AliyunOss\Laravel\AliyunOssServiceProvider::class,
)
-
Edit the config/app.php file to insert an aliases segment., (*6)
'aliases' => array(
// ...
'OSS' => AliyunOss\Laravel\AliyunOssFacade::class,
)
-
Edit the routes/web.php file as follows:, (*7)
Route::get('/', function()
{
$client = App::make('aliyun-oss');
$client->putObject("your bucket", "your object", "content you want to upload");
$result = $client->getObject("your bucket", "your boject");
echo $result;
});
For the Lumen Project
-
Edit the vendor/aliyun-oss/aliyun-oss-php-sdk-laravel/config/config.php file as follows:, (*8)
return [
'id' => 'your id',
'key' => 'your key',
'endpoint' => 'your endpoint',
'bucket' => 'your bucket'
];
-
Edit the bootstrap/app.php file and register OSS Service Providers:, (*9)
$app->register(AliyunOss\Laravel\AliyunOssServiceProvider::class);
-
Edit the routes/web.php file as follows:, (*10)
$app->get('/', function () use ($app) {
$client = $app->make('aliyun-oss');
$client->putObject('your bucket', 'your key', "content you want to upload");
$result = $client->getObject("your bucket", "your boject");
echo $result;
});
Run the Test Case
- Set the following environment variables:
export OSS_ENDPOINT=''
export OSS_ACCESS_KEY_ID=''
export OSS_ACCESS_KEY_SECRET=''
export OSS_BUCKET=''
- Switch to the project directory and run the following command:
php vendor/bin/phpunit
License
dev-master
9999999-dev
https://github.com/aliyun
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
Sources
Download
MIT
The Requires
The Development Requires
lumen
sdk
laravel 5
aliyun
oss
alicloud
dev-refine-readme
dev-refine-readme
https://github.com/aliyun
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
Sources
Download
MIT
The Requires
The Development Requires
lumen
sdk
laravel 5
aliyun
oss
alicloud
v1.2.0
1.2.0.0
https://github.com/aliyun
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
Sources
Download
MIT
The Requires
The Development Requires
lumen
sdk
laravel 5
aliyun
oss
alicloud
v1.1.0
1.1.0.0
https://github.com/aliyun
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
Sources
Download
MIT
The Requires
The Development Requires
lumen
sdk
laravel 5
aliyun
oss
alicloud
v1.0.0
1.0.0.0
https://github.com/aliyun
A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.
Sources
Download
MIT
The Requires
The Development Requires
lumen
sdk
laravel 5
aliyun
oss
alicloud