{"id":15866149,"url":"https://github.com/sony/cdn-purge-control-php","last_synced_at":"2025-03-16T01:33:18.413Z","repository":{"id":57055786,"uuid":"49104309","full_name":"sony/cdn-purge-control-php","owner":"sony","description":"Multi CDN purge control library for PHP","archived":false,"fork":false,"pushed_at":"2016-10-06T08:52:20.000Z","size":32,"stargazers_count":8,"open_issues_count":1,"forks_count":4,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-12T22:52:00.730Z","etag":null,"topics":["aws-cloudfront","cdn","composer","limelight","php","purge-contents"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sony.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-06T01:41:28.000Z","updated_at":"2023-04-07T09:55:07.000Z","dependencies_parsed_at":"2022-08-24T14:00:25.922Z","dependency_job_id":null,"html_url":"https://github.com/sony/cdn-purge-control-php","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sony%2Fcdn-purge-control-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sony%2Fcdn-purge-control-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sony%2Fcdn-purge-control-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sony%2Fcdn-purge-control-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sony","download_url":"https://codeload.github.com/sony/cdn-purge-control-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221633874,"owners_count":16855341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-cloudfront","cdn","composer","limelight","php","purge-contents"],"created_at":"2024-10-05T23:04:37.351Z","updated_at":"2024-10-27T06:02:59.594Z","avatar_url":"https://github.com/sony.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"CdnPurge, Multi CDN purge control library for PHP\n=================================================\n\n[![Build Status](https://travis-ci.org/sony/cdn-purge-control-php.svg)](https://travis-ci.org/sony/cdn-purge-control-php)\n[![Stable Version](https://img.shields.io/packagist/v/sony/cdn-purge-control-php.svg)](https://packagist.org/packages/sony/cdn-purge-control-php)\n[![MIT license](https://img.shields.io/packagist/l/sony/cdn-purge-control-php.svg)](https://github.com/sony/cdn-purge-control-php/blob/master/LICENSE)\n\n**CdnPurge** is a lightweight PHP CDN client which makes it easier to purge contents for\nmultiple CDN providers. Currently, CdnPurge supports [AWS CloudFront](https://aws.amazon.com/cloudfront/)\nand [Limelight](https://www.limelight.com/).\n\n- Simple common interface to purge contents against multiple CDNs and get purge status.\n- Easily extensible to other CDN providers.\n- Easy code maintenance.\n- Requires PHP \u003e= 5.5 compiled with cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g. NSS or OpenSSL).\n- Uses [Guzzle](https://github.com/guzzle/guzzle) to make http rest api calls.\n\n## Installing CdnPurge\n\nThe recommended way to install CdnPurge is through\n[Composer](http://getcomposer.org).\n\n```bash\n# Install Composer\ncurl -sS https://getcomposer.org/installer | php\n```\n\nNext, run the Composer command to install the latest stable version of CdnPurge:\n\n```bash\ncomposer.phar require sony/cdn-purge-control-php\n```\n\nAfter installing, you need to require Composer's autoloader:\n\n```php\nrequire 'vendor/autoload.php';\n```\n\nYou can then later update CdnPurge using composer:\n\n ```bash\ncomposer.phar update\n ```\n\n## Quick Examples\n\n### Make purge request\n\n```php\n\u003c?php\n// Require the Composer autoloader.\nrequire 'vendor/autoload.php';\n\nuse CdnPurge\\CdnPurgeFactory;\nuse CdnPurge\\CdnType;\n\n$config = array(\n    'cloudfront' =\u003e array(\n            'distribution_id' =\u003e 'your cloudfront distribution id'\n        ),\n    'limelight' =\u003e array(\n            'shortname' =\u003e 'your limelight api shortname'\n            'publish_url' =\u003e 'your limelight publish url'\n        )\n);\n$credential = array(\n    'cloudfront' =\u003e array(\n            'key' =\u003e 'aws iam account access key id',\n            'secret' =\u003e 'aws iam account secret access key'\n        ),\n    'limelight' =\u003e array(\n            'username' =\u003e 'limelight account username',\n            'shared_key' =\u003e 'limelight account shared key'\n        )\n);\n\ntry {\n    // Make a purge request against AWS cloudfront\n    $cfClient = CdnPurgeFactory::build(CdnType::CLOUDFRONT, $credential, $config);\n    $cfRequestId = $client-\u003ecreatePurgeRequest(array(\n        '/my-path-1',\n        '/my-path-2'\n    ));\n\n    // Make a purge request against Limelight\n    $llClient = CdnPurgeFactory::build(CdnType::LIMELIGHT, $credential, $config);\n    $llRequestId = $client-\u003ecreatePurgeRequest(array(\n        'http://my-limelight-domain/my-path-1',\n        '/my-path-2'\n    ));\n\n} catch (CdnPurge\\CdnClientException $e) {\n    echo \"An error occurred: \" . $e-\u003egetMessage();\n}\n```\n\n### Get purge status\n\n```php\n\u003c?php\n// Get the purge status\ntry {\n    $client-\u003egetPurgeStatus($requestId);\n    // 'InProgress' or 'Complete'\n} catch (CdnPurge\\CdnClientException $e) {\n    echo \"There was an error getting purge status.\\n\";\n}\n```\n\nSee [example](https://github.com/sony/cdn-purge-control-php/tree/master/example) for a running example of how to use this library.\n\n## Specifying credentials\nCredentials are specified as an array.\n\n### AWS CloudFront\n\n| Credential key        | Type    | Required  | Description   |\n| -------------         | ------  | --------  | ------------  |\n| cloudfront['key']     | String  | Yes       | AWS IAM user Access Key Id. See [here](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html) for details |\n| cloudfront['secret']  | String  | Yes       | AWS IAM user Secret Access Key. See [here](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html) for details |\n\n### Limelight\n\n| Credential key            | Type    | Required  | Description   |\n| -------------             | ------  | --------  | ------------  |\n| limelight['username']     | String  | Yes       | Limelight account username |\n| limelight['shared_key']   | String  | Yes       | Limelight account share key |\n\n## Specifying configurations\nConfigurations are specified as an array.\n\n### AWS CloudFront\n\n| Config key                    | Type    | Required  | Description   |\n| -------------                 | ------  | --------  | ------------  |\n| cloudfront['distribution_id'] | String  | Yes       | AWS CloudFront Distribution Id |\n| http['proxy']                 | String  | No        | Specify http proxy for the client. For example: 'my-company.proxy.com:1234' |\n\n### Limelight\n\n| Config key                        | Type    | Required  | Description   |\n| -------------                     | ------- | --------  | -----------   |\n| limelight['shortname']            | String  | Yes       | Limelight api shortname |\n| 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' |\n| limelight['evict']          | Boolean  | No        | If true, matching cache objects are evicted (deleted), otherwise invalidated. Default is false |\n| limelight['exact']          | Boolean  | No        | If true, paths to be purged are treated as an exact public URL. Optional. Default is false. Default is false |\n| 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 |\n| limelight['email']                | Array   | No        | Array of email info to send purge completion details to |\n| limelight['email']['subject']     | String  | No        | Subject of sent mail |\n| limelight['email']['to']          | String  | Yes       | Email recipient address. A comma is used to separate multiple recipients |\n| limelight['email']['cc']          | String  | No        | Email carbon copy. A comma is used to separate multiple recipients |\n| limelight['email']['bcc']         | String  | No        | Email blind carbon copy. A comma is used to separate multiple recipients |\n| limelight['callback']            | Array   | No        | HTTP(S) callback URL for purge request state transition notifications |\n| limelight['callback']['url']     | String  | Yes       | Callback url\n| http['proxy']                     | String  | No        | Specify http proxy for the client. For example: 'my-company.proxy.com:1234' |\n\nDevelopment\n-----------\n\n- [Running tests](https://github.com/sony/cdn-purge-control-php/blob/master/tests/README.md)\n- [Generating documentation](https://github.com/sony/cdn-purge-control-php/blob/master/docs/README.md)\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nSee [LICENSE](https://github.com/sony/cdn-purge-control-php/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsony%2Fcdn-purge-control-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsony%2Fcdn-purge-control-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsony%2Fcdn-purge-control-php/lists"}