shardimage / yii2-shardimage
yii2-shardimage package
Installs: 5 873
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
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-11-19 22:55:29 UTC
README
Yii2 Wrapper for Shardimage PHP
Installation
The preferred way to install this extension is through composer.
composer require shardimage/yii2-shardimage
Usage
Once the extension is installed, simply use it in your code by:
Config
'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, ], // ... ],
Usage
Manage Clouds
/* @var $service \shardimage\shardimagephp\services\CloudService */ $service = Yii::$app->shardimage->cloud();
Manage Backups
/* @var $service \shardimage\shardimagephp\services\BackupService */ $service = Yii::$app->shardimage->backup();
Manage Firewalls
/* @var $service \shardimage\shardimagephp\services\FirewallService */ $service = Yii::$app->shardimage->firewall();
Manage Images
/* @var $service \shardimage\shardimagephp\services\ImageService */ $service = Yii::$app->shardimage->image();
Manage Uploads
/* @var $service \shardimage\shardimagephp\services\UploadService */ $service = Yii::$app->shardimage->upload();
Manage Urls
/* @var $service \shardimage\shardimagephp\services\UrlService */ $service = Yii::$app->shardimage->url();
For more informations, please check the Shardimage PHP package or the Shardimage documentation.
Changelog
All notable changes to this project will be documented in the CHANGELOG file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.