emartech / session-validator-client
PHP client for Emarsys session validator service
Installs: 1 925
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 19
Forks: 1
Open Issues: 5
Requires
- php: >=8.1
- emartech/escher: ^4.0
- guzzlehttp/guzzle: ^7.4
- psr/log: ^3.0
Requires (Dev)
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.3
Suggests
- ext-apcu: Needed to support APC cache
This package is auto-updated.
Last update: 2024-11-03 11:48:56 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