All Projects → sony → Cdn Purge Control Php

sony / Cdn Purge Control Php

Licence: mit
Multi CDN purge control library for PHP

Projects that are alternatives of or similar to Cdn Purge Control Php

Aliyun Sdk Js
阿里云 SDK for Javascript,支持在浏览器和 Nodejs 环境使用,支持大部分阿里云服务。
Stars: ✭ 727 (+7977.78%)
Mutual labels:  cdn
Url Rewrites
Magento 1.x module to target the URL Rewrite issue
Stars: ✭ 17 (+88.89%)
Mutual labels:  composer
Wp Multitenancy Boilerplate
WordPress multitenancy boilerplate configured and managed with Composer and PHP dotenv.
Stars: ✭ 24 (+166.67%)
Mutual labels:  composer
Hlsjs P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 759 (+8333.33%)
Mutual labels:  cdn
Postprocessing
A post processing library that provides the means to implement image filter effects for three.js.
Stars: ✭ 830 (+9122.22%)
Mutual labels:  composer
Composer Asset Plugin
NPM/Bower Dependency Manager for Composer
Stars: ✭ 898 (+9877.78%)
Mutual labels:  composer
Composer
Dependency Manager for PHP
Stars: ✭ 25,994 (+288722.22%)
Mutual labels:  composer
Tiny Composer Installer
Small, auditable Composer installer, well suited for automated environments.
Stars: ✭ 9 (+0%)
Mutual labels:  composer
Ical
iCal-creator for PHP
Stars: ✭ 891 (+9800%)
Mutual labels:  composer
Parameterhandler
Composer script handling your ignored parameter file
Stars: ✭ 906 (+9966.67%)
Mutual labels:  composer
Satis On Heroku
Your private Satis instance on Heroku, just one click away.
Stars: ✭ 5 (-44.44%)
Mutual labels:  composer
Package Skeleton
📦 My base for PHP packages.
Stars: ✭ 6 (-33.33%)
Mutual labels:  composer
Aliyun Sts
基于阿里云openapi系列接口中STS最新版本的SDK进行封装的composer package,解耦其他产品SDK,各个产品SDK功能使用组件化加载,减少代码臃肿。
Stars: ✭ 19 (+111.11%)
Mutual labels:  composer
Awesome Composer
😎 A curated awesome list for Composer, Packagist, Satis, Plugins, Scripts, Composer related resources, tutorials.
Stars: ✭ 738 (+8100%)
Mutual labels:  composer
Halite
High-level cryptography interface powered by libsodium
Stars: ✭ 933 (+10266.67%)
Mutual labels:  composer
Composer Merge Plugin
Merge one or more additional composer.json files at Composer runtime
Stars: ✭ 718 (+7877.78%)
Mutual labels:  composer
Syscrack
Virtual Online Crime Simulator (VOCS) written in PHP 7.0
Stars: ✭ 17 (+88.89%)
Mutual labels:  composer
Kirby Sri
Subresource integrity hashing & cache-busting static assets for Kirby
Stars: ✭ 9 (+0%)
Mutual labels:  cdn
Composer Git Hooks
Easily manage git hooks in your composer config
Stars: ✭ 838 (+9211.11%)
Mutual labels:  composer
Webside
基于RBAC的完全响应式权限管理系统
Stars: ✭ 19 (+111.11%)
Mutual labels:  cdn

CdnPurge, Multi CDN purge control library for PHP

Build Status Stable Version MIT license

CdnPurge is a lightweight PHP CDN client which makes it easier to purge contents for multiple CDN providers. Currently, CdnPurge supports AWS CloudFront and Limelight.

  • Simple common interface to purge contents against multiple CDNs and get purge status.
  • Easily extensible to other CDN providers.
  • Easy code maintenance.
  • Requires PHP >= 5.5 compiled with cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g. NSS or OpenSSL).
  • Uses Guzzle to make http rest api calls.

Installing CdnPurge

The recommended way to install CdnPurge is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of CdnPurge:

composer.phar require sony/cdn-purge-control-php

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update CdnPurge using composer:

composer.phar update

Quick Examples

Make purge request

<?php
// Require the Composer autoloader.
require 'vendor/autoload.php';

use CdnPurge\CdnPurgeFactory;
use CdnPurge\CdnType;

$config = array(
    'cloudfront' => array(
            'distribution_id' => 'your cloudfront distribution id'
        ),
    'limelight' => array(
            'shortname' => 'your limelight api shortname'
            'publish_url' => 'your limelight publish url'
        )
);
$credential = array(
    'cloudfront' => array(
            'key' => 'aws iam account access key id',
            'secret' => 'aws iam account secret access key'
        ),
    'limelight' => array(
            'username' => 'limelight account username',
            'shared_key' => 'limelight account shared key'
        )
);

try {
    // Make a purge request against AWS cloudfront
    $cfClient = CdnPurgeFactory::build(CdnType::CLOUDFRONT, $credential, $config);
    $cfRequestId = $client->createPurgeRequest(array(
        '/my-path-1',
        '/my-path-2'
    ));

    // Make a purge request against Limelight
    $llClient = CdnPurgeFactory::build(CdnType::LIMELIGHT, $credential, $config);
    $llRequestId = $client->createPurgeRequest(array(
        'http://my-limelight-domain/my-path-1',
        '/my-path-2'
    ));

} catch (CdnPurge\CdnClientException $e) {
    echo "An error occurred: " . $e->getMessage();
}

Get purge status

<?php
// Get the purge status
try {
    $client->getPurgeStatus($requestId);
    // 'InProgress' or 'Complete'
} catch (CdnPurge\CdnClientException $e) {
    echo "There was an error getting purge status.\n";
}

See example for a running example of how to use this library.

Specifying credentials

Credentials are specified as an array.

AWS CloudFront

Credential key Type Required Description
cloudfront['key'] String Yes AWS IAM user Access Key Id. See here for details
cloudfront['secret'] String Yes AWS IAM user Secret Access Key. See here for details

Limelight

Credential key Type Required Description
limelight['username'] String Yes Limelight account username
limelight['shared_key'] String Yes Limelight account share key

Specifying configurations

Configurations are specified as an array.

AWS CloudFront

Config key Type Required Description
cloudfront['distribution_id'] String Yes AWS CloudFront Distribution Id
http['proxy'] String No Specify http proxy for the client. For example: 'my-company.proxy.com:1234'

Limelight

Config key Type Required Description
limelight['shortname'] String Yes Limelight api shortname
limelight['publish_url'] String No Limelight publish url. This is prepended to the purge path if the path doesn't start with 'http' or 'https'
limelight['evict'] Boolean No If true, matching cache objects are evicted (deleted), otherwise invalidated. Default is false
limelight['exact'] Boolean No If true, paths to be purged are treated as an exact public URL. Optional. Default is false. Default is false
limelight['incqs'] Boolean No If true, pattern is allowed to match query string part of URL, otherwise query string is stripped before matching. Default is false
limelight['email'] Array No Array of email info to send purge completion details to
limelight['email']['subject'] String No Subject of sent mail
limelight['email']['to'] String Yes Email recipient address. A comma is used to separate multiple recipients
limelight['email']['cc'] String No Email carbon copy. A comma is used to separate multiple recipients
limelight['email']['bcc'] String No Email blind carbon copy. A comma is used to separate multiple recipients
limelight['callback'] Array No HTTP(S) callback URL for purge request state transition notifications
limelight['callback']['url'] String Yes Callback url
http['proxy'] String No Specify http proxy for the client. For example: 'my-company.proxy.com:1234'

Development

License

The MIT License (MIT)

See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].