songshenzong / qiniu
Enhanced Qiniu SDK
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 3 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.3
- qiniu/php-sdk: ^7.1
Requires (Dev)
- laravel/framework: 5.5.*
- phpunit/phpunit: ~7.0
This package is not auto-updated.
Last update: 2019-02-14 20:36:04 UTC
README
About
Enhanced Qiniu SDK
Installation
Require this package with composer:
composer require songshenzong/qiniu
Laravel
Publish configuration files. If not, They can not be serialized correctly when you execute the config:cache
Artisan command.
php artisan vendor:publish --provider="Songshenzong\Qiniu\ServiceProvider"
Common Method
public function qiniu() { return qiniu('Key', 'secret') -> bucket('bucketName') -> domain('http://my.com/') -> prefix('project_name') -> addPrefix('dev'); }
Put File
$file = request() -> file('file'); list($success, $error) = $this -> qiniu() -> putFile($file); if ($error !== null) { return $error; } else { return $success; }
Success Return
{ "hash": "FrNDCStnjFNdyTZSOj0MlcW7vW4Y", "key": "project_name/dev/b4937112-288c-3a98-a630-f33034a28650.jpg", "url": "http://my.com/project_name/dev/b4937112-288c-3a98-a630-f33034a28650.jpg" }
Use Qiniu Key
putFile($file,true);
Success Return
{ "hash": "FrNDCStnjFNdyTZSOj0MlcW7vW4Y", "key": "FrNDCStnjFNdyTZSOj0MlcW7vW4Y", "url": "http://my.com/FrNDCStnjFNdyTZSOj0MlcW7vW4Y" }
Put Data
list($success, $error) = $this -> qiniu() -> put('love.txt','I Love U'); if ($error !== null) { return $error; } else { return $success; }
Delete
return $this -> qiniu() -> delete($key);
Documentation
Please refer to our extensive Wiki documentation for more information.
Support
For answers you may not find in the Wiki, avoid posting issues. Feel free to ask for support on Songshenzong.com
License
This package is licensed under the BSD 3-Clause license.