Skip to content

Headers

Ale Mostajo edited this page Sep 30, 2020 · 1 revision

The client supports the ability to specify custom HTTP headers.

Usage

Headers can be added using the header() chainable method after instantiating the Client, like this:

$response = Api::activate(
    Client::instance()
       ->header('Authorization', 'Bearer {token}')
       ->header('X-Token', '{value}'),
    function() use($licenseKey) {
        // Code here...
    },
    function($licenseString) {
        // Code here...
    }
);

Parameters

Parameter Type Description
key string Header key.
value string Header value.

Clear all headers

Pass a null value to clear al previously added headers.

$response = Api::activate(
    Client::instance()->header(null),
    function() use($licenseKey) {
        // Code here...
    },
    function($licenseString) {
        // Code here...
    }
);
Clone this wiki locally