Download the PHP package webignition/guzzle-http-authentication-middleware without Composer
On this page you can find all versions of the php package webignition/guzzle-http-authentication-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webignition/guzzle-http-authentication-middleware
More information about webignition/guzzle-http-authentication-middleware
Files in webignition/guzzle-http-authentication-middleware
Package guzzle-http-authentication-middleware
Short Description Http authentication middleware for Guzzle6
License MIT
Homepage https://github.com/webignition/guzzle-http-authentication-middleware
Informations about the package guzzle-http-authentication-middleware
Guzzle HTTP Authentication Middleware
Overview
Middleware for Guzzle 6 for setting basic http authentication on all requests sent by a client.
An authentication header is added to any valid request. A valid request is one where the request host matches a pre-specified domain name.
Useful if your circumstances match all or some of the following:
- you need to set HTTP authentication on all requests sent by a client for a specific domain only
- you don't want to specifically add an authorization header to each request made, particularly if there are many points across an application where requests are made
- you cannot determine in advance to which domains requests might be made and you don't want to leak credentials by means of setting an authorization header on every single request that your client sends
Maybe, just maybe, this is for you.
Usage example
Application-level considerations
Let's assume you are building a modern PHP application that utilises controllers, services and so on.
Define your HttpAuthenticationMiddleware
instance as a service. Use dependency injection to inject that service into whichever part of your application needs to set HTTP authentication credentials. Call HttpAuthenticationMiddleware::setHttpAuthenticationCredentials()
as needed, passing in a HttpAuthenticationCredentials
instance containing relevant values.