emartech/session-validator-client

PHP client for Emarsys session validator service

3.0.0 2024-08-03 11:20 UTC

This package is auto-updated.

Last update: 2024-12-03 12:08:52 UTC


README

PHP client for Emarsys session validator service

Install

composer require emartech/session-validator-client

Usage

Validating a single MSID

$client = Client::create('https://session-validator.gservice.emarsys.net', 'escher_key', 'escher_secret');

var_dump($client->isValid('msid'));

Requests without Escher

For mTLS on GAP.

$client = Client::create('http://session-validator-web.security');

var_dump($client->isValid('msid'));

Batch validating multiple MSIDs

Returns an array of the invalid MSIDs.

$client = Client::create('https://session-validator.gservice.emarsys.net', 'escher_key', 'escher_secret');

var_dump($client->filterInvalid(['msid1', 'msid2']));

Caching results

$client = Client::create('https://session-validator.gservice.emarsys.net', 'escher_key', 'escher_secret');
$cachedClient = CachedClient::create($client);

var_dump($cachedClient->isValid('msid'));

Logging

To enable logging, add a PSR-3 compatible logger to the client

use Monolog\Logger;

$client = Client::create('https://session-validator.gservice.emarsys.net', 'escher_key', 'escher_secret');
$client->setLogger(new Logger('name'));

Use with CodeShip

Because of the APCu dependency, install extension before composer install

printf "\n" | pecl install apcu

Local development

make install
make test
make style