2017 © Pedro Peláez
 

library guzzle-hsts

image

cheatcodes/guzzle-hsts

  • Tuesday, November 1, 2016
  • by CheatCodes
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

guzzle-hsts

Build Status Coverage Status Quality Score Software License Packagist Version, (*1)

This is a Guzzle middleware to handle HTTP Strict Transport Security., (*2)

Installation

Make sure you have Composer installed and add guzzle-hsts as a dependency., (*3)

$ composer require cheatcodes/guzzle-hsts

Usage

Make sure Guzzle uses the CheatCodes\GuzzleHsts\HstsMiddleware::handler() as a middleware by pushing it onto the handler stack. After that, all http requests to known HSTS hosts will be automatically rewritten to https., (*4)

An example:, (*5)

use CheatCodes\GuzzleHsts\HstsMiddleware;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

$stack = HandlerStack::create();

// Add HSTS middleware to the handler
$stack->push(HstsMiddleware::handler());

// Initialize the Guzzle client with the handler
$client = new Client(['handler' => $stack]);

// Make a request to a https host with HSTS enabled
$client->request('GET', 'https://hsts.badssl.com/');

// Later requests to the same hosts will automatically be rewritten to https
$client->request('GET', 'http://hsts.badssl.com/');

License

MIT, (*6)

The Versions

01/11 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar CheatCodes

25/10 2016