- Curl - provides CurlExtension and simple cURL client
- SAPI - provides SapiRequestExtension (fake request in console mode)
- BasicAuth - simple basic authentication
- Useful classes
There is a prepared simple cURL client in this package.
You have to register it at first.
extensions: curl: Contributte\Http\DI\CurlExtension
Extension registers by automatic
Contributte\Http\Curl\CurlClient as a service.
Every modern PHP application needs sometimes to run a few console commands. Let's say sending newsletter campaigns. There is
a tiny problem, there is no request/URL in console/SAPI (Server API) mode. Don't worry, just use our fake request -
The easiest way is to register extension without any parameters.
extensions: sapi: Contributte\Http\DI\SapiRequestExtension
Alternatively, you can pass directly URL address.
extensions: sapi: Contributte\Http\DI\SapiRequestExtension(https://contributte.org)
List of all options:
sapi: url: https://contributte.org # other params query: NULL post: NULL files: NULL cookies: NULL headers: NULL method: NULL remoteAddress: NULL remoteHost: NULL rawBodyCallback: NULL
extensions: auth: Contributte\Http\DI\BasicAuthExtension
You have to
enable this extension by yourself. It's disabled by default.
auth: enabled: true/false title: My security zone users: username1: password: password1 unsecured: true username2: password: $2y$10$p.U5q.BuQp02srggig.VDOqj5m7pE1rCwKavVQ3S2TrqWlkqu3qlC unsecured: false # secured by default username3: password: $2y$10$bgievYVQMzsRn5Ysup.NKOVUk66aitAniAmts2EJAa91eqkAhohvC
Few methods added:
use Contributte\Http\Url; $url = new Url('https://github.com'); $url->appendPath('foo'); # https://github.com/foo $url->appendPath('bar'); # https://github.com/foobar