jdreesen/camo-url-generator

A library that generates URLs for usage with camo TLS image proxy.

v1.0.0 2015-07-20 20:09 UTC

This package is auto-updated.

Last update: 2024-11-05 19:21:51 UTC


README

Build Status License

A PHP library that generates camouflaged URLs for usage with camo or go-camo TLS image proxy.

Installation

Just run

$ composer require jdreesen/camo-url-generator

Example

use Dreesen\Image\HexCamo;
use Dreesen\Image\HttpOnlyCamo;

$camo = new HttpOnlyCamo(new HexCamo('https://img.example.org', 'secret'));

echo $camo->camouflage('http://example.org/image.jpg');

The secret is the same HMAC key you used on your camo server instance running on https://img.example.org.

What's inside?

  • Dreesen\Image\Camo: Interface for your type-hinting which is implemented by all the following classes.
  • Dreesen\Image\HexCamo: Generates URLs for usage with the camo or go-camo image proxy in HEX format.
  • Dreesen\Image\Base64Camo: Generates URLs for usage with the go-camo image proxy in Base64 format.
  • Dreesen\Image\QueryStringCamo: Generates URLs for usage with the camo image proxy in query string format.
  • Dreesen\Image\HttpOnlyCamo: Decorator to only camouflage HTTP (non-secure) URLs.
  • Dreesen\Image\NoCamo: Disables image camouflage by returning given URLs as they are.

Credit

Thanks to Corey Donohoe for creating Camo and to cactus for the GoLang port of Camo.

License

All contents of this package are licensed under the MIT license.