2017 © Pedro Peláez
 

library http-client-hints

Utilities for working with HTTP Client Hints.

image

jsor/http-client-hints

Utilities for working with HTTP Client Hints.

  • Monday, May 9, 2016
  • by jsor
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

HTTP Client Hints

Build Status Coverage Status, (*1)

Utilities for working with HTTP Client Hints., (*2)

Installation

Install the latest version with Composer., (*3)

composer require jsor/http-client-hints

Check the Packagist page for all available versions., (*4)

Example

$resolved = (new Jsor\HttpClientHints\Resolver())
    ->withAllowedHeaders([
        // Process only Width and DPR headers
        'Width',
        'DPR',
    ])
    ->withMapping([
        // Map Width header to w key
        'width'  => 'w',
        // Needed to extract the height from the query params
        // for recalculation depending on Width if present
        'height' => 'h',
    ])
    ->resolve($_SERVER, $_GET)
;

if (isset($resolved['dpr'])) {
    header('Content-DPR: ' . $resolved['dpr']);
    header('Vary: DPR', false);
}

if (isset($resolved['w'])) {
    header('Vary: Width', false);
}

// Use $resolved to generate thumbnails.
// If you use Glide (https://github.com/thephpleague/glide), this could look
// something like:

$server = League\Glide\ServerFactory::create([
    'source' => 'path/to/source/folder',
    'cache' => 'path/to/cache/folder',
]);
$server->outputImage($path, array_merge($_GET, $resolved));

License

Copyright (c) 2016-2018 Jan Sorgalla. Released under the MIT License., (*5)

The Versions

09/05 2016

dev-master

9999999-dev

Utilities for working with HTTP Client Hints.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

http responsive client image resolver hints

11/02 2016

v0.1.1

0.1.1.0

Utilities for working with HTTP Client Hints.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

http responsive client image resolver hints

11/02 2016

v0.1.0

0.1.0.0

Utilities for working with HTTP Client Hints.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

http responsive client image resolver hints