定制 conneredu300/php-keycdn-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

conneredu300/php-keycdn-api

Composer 安装命令:

composer require conneredu300/php-keycdn-api

包简介

PHP Library for the KeyCDN API

README 文档

README

PHP Library for the KeyCDN API

KeyCDN is a Content Delivery Network to accelerate your web assets.

Please contact us if you got any questions or if you need more functionality: KeyCDN Support

Requirements

  • PHP 5.3 or above
  • PHP Curl Extension

Usage

<?php

require 'path_to_repo/src/KeyCDN.php';

// create the REST object
$keycdn_api = new KeyCDN('your_api_key');

// get zone information
$keycdn_api->get('zones.json');


// change zone name and check if successfull
$result = $keycdn_api->post('zones/123.json', array(
    'name' => 'newzonename',
));


// convert json-answer into an array
$answer = json_decode($result, true);

if ($answer['status'] == 'success') {
    echo 'Zonename successfully changed...';
}

get traffic stats

// get traffic stats for the last 30 days
$result = $keycdn_api->get('reports/traffic.json', array(
    'zone_id' => 123,
    'start'   => Carbon::now('UTC')->subDays(30)->timestamp,
    'end'     => Carbon::now('UTC')->timestamp
));

// convert json-answer into an array
$answer = json_decode($result, true);

// since we get results pr day, we need to sum them
if ($answer['status'] == 'success') {
    $amount = 0;
    foreach ($answer['data']['stats'] as $stats) {
        $amount += $stats['amount'];
    }

    echo 'Traffic last 30 days: ' . $amount;
} else {
    echo 'Something went wrong...'
}

single or bulk url purge

$result = $keycdn->delete('zones/purgeurl/{zone_id}.json', array(
    'urls' => array('foo-1.kxcdn.com/bar1.jpg','foo-1.kxcdn.com/bar2.jpg'),
));

Methods

Each of the supported HTTP methods (GET, PUT, POST, DELETE) is produced by an own function in the KeyCDN lib. E.g. POST becomes $keycdn_api->post(...);.

统计信息

  • 总下载量: 5.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固