1. Go to this page and download the library: Download bavix/glow-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bavix / glow-api example snippets
$client = new \Bavix\GlowApi\HttpClient(BASE_URL, APP_TOKEN);
$api = new \Bavix\GlowApi\Api($client);
$api->createBucket('users');
$api->createView('users', [
'name' => 'avatar',
'type' => 'contain',
'width' => 160,
'height' => 160,
'quality' => 75,
'optimize' => true,
'webp' => true,
]);
$files = (new \Bavix\GlowApi\File\Upload())
->addFile('id_1.svg', 'https://stat.babichev.net/svg/logo.svg')
->addFile('id_1.png', 'https://stat.babichev.net/png/logo.png')
;
$response = $api->writeFile('users', $files); // upload to cdn
// Glow CDN will automatically generate views and you can get them from the links:
//
// SVG:
// original: http://glow.local/capsule/users/id_1.svg
// thumbnail: http://glow.local/capsule/users:avatar/id_1.svg.jpg
// thumbnail+webp: http://glow.local/capsule/users:avatar/id_1.svg.jpg.webp
//
// PNG:
// original: http://glow.local/capsule/users/id_1.png
// thumbnail: http://glow.local/capsule/users:avatar/id_1.png
// thumbnail+webp: http://glow.local/capsule/users:avatar/id_1.png.webp
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.