Skip to content

emartech/session-validator-client-php

Repository files navigation

Session Validator Client PHP

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

About

PHP client for Emarsys session validator service

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published