shardimage / yii2-shardimage
yii2-shardimage 包
1.0.0-alpha7
2021-01-19 14:42 UTC
Requires
- php: ~7.1
- psr/log: ^1.0
- shardimage/shardimage-php: ^1.0
- yiisoft/yii2: ^2.0.13
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-09-19 22:30:16 UTC
README
Shardimage PHP 的 Yii2 封装
安装
安装此扩展的首选方法是使用 composer。
composer require shardimage/yii2-shardimage
用法
扩展安装后,只需在代码中简单使用即可
配置
'components' => [ // ... 'shardimage' => [ // Component class 'class' => \shardimage\yii2shardimage\Component::class, // Useful defaults: // Default cloud ID 'cloudId' => 'R0Cu47n0', // Authentication: // API key (generated on shardimage.com) 'apiKey' => '6174447875126537682', // API secret (generated on shardimage.com) 'apiSecret' => '5Tgzi4InVtbuKRao0LYBv4rfkGp7SFZgC6cXymsf', // Image secret (generated on shardimage.com) 'imageSecret' => 'XUEpxvCkHcKWf0qL89uy1tbezR5FONQYiSM7mn4j', // One-time API access token 'apiAccessToken' => '0uiW-qKOIjIcAdt8LEMnusose5XV8qEb6351ZFaN', // One-time API access token secret 'apiAccessTokenSecret' => 'g37rei4353frj5746', // API key, secret and cloud ID in URL format 'apiConfig' => 'apiKey:apiSecret@cloudId', // Hosts & proxy: // Host for serving images, default: https://img.shardimage.com 'imageHost' => 'https://img.shardimage.com', // API host, default: https://api.shardimage.com 'apiHost' => 'https://api.shardimage.com', // Proxy in HTTP communication 'proxy' => 'http://127.0.0.1:8080', // Caching: // Cache instance for the Etag handler 'cache' => new \yii\caching\FileCache(), // Cache expiration in seconds, in accordance with the used caching mechanism 'cacheExpiration' => 3600, // Logging: // Print debug log to console, default: false 'debug' => true, // Logger instance, classname, or an application component ID. 'logger' => Logger::class, // Special: // Use gzip in HTTP communication, default: true 'useGzip' => true, // Use PHP MsgPack in HTTP communication, default: true 'useMsgPack' => true, // Dismiss non-fatal exceptions, default: true 'softExceptionEnabled' => true, ], // ... ],
用法
管理云
/* @var $service \shardimage\shardimagephp\services\CloudService */ $service = Yii::$app->shardimage->cloud();
管理备份
/* @var $service \shardimage\shardimagephp\services\BackupService */ $service = Yii::$app->shardimage->backup();
管理防火墙
/* @var $service \shardimage\shardimagephp\services\FirewallService */ $service = Yii::$app->shardimage->firewall();
管理镜像
/* @var $service \shardimage\shardimagephp\services\ImageService */ $service = Yii::$app->shardimage->image();
管理上传
/* @var $service \shardimage\shardimagephp\services\UploadService */ $service = Yii::$app->shardimage->upload();
管理 URL
/* @var $service \shardimage\shardimagephp\services\UrlService */ $service = Yii::$app->shardimage->url();
更多信息,请查阅 Shardimage PHP 包 或 Shardimage 文档。
更新日志
此项目的所有重大更改都将记录在 CHANGELOG 文件中。
格式基于 Keep a Changelog,并且此项目遵循 语义化版本控制。