-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Józsa Csongor <[email protected]>
- Loading branch information
Showing
16 changed files
with
2,625 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/tests/ export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: php | ||
php: | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
install: | ||
- composer install | ||
script: | ||
- composer style | ||
- composer test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Emarsys Technologies Ltd. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
# session-validator-client-php | ||
# session-validator-client-php ![Build status](https://travis-ci.org/emartech/session-validator-client-php.svg?branch=master) | ||
|
||
PHP client for Emarsys session validator service | ||
|
||
## Install | ||
|
||
```bash | ||
composer require emartech/session-validator-client | ||
``` | ||
|
||
## Usage | ||
|
||
### Validating a single MSID | ||
|
||
```php | ||
$client = Client::create('https://service-url', 'escher_key', 'escher_secret'); | ||
|
||
var_dump($client->isValid('msid')); | ||
``` | ||
|
||
### Batch validating multiple MSIDs | ||
|
||
Returns an array of the invalid MSIDs. | ||
|
||
```php | ||
$client = Client::create('https://service-url', 'escher_key', 'escher_secret'); | ||
|
||
var_dump($client->filterInvalid(['msid1', 'msid2'])); | ||
``` | ||
|
||
### Caching results | ||
|
||
```php | ||
$client = Client::create('https://service-url', '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 | ||
|
||
```php | ||
use Monolog\Logger; | ||
|
||
$client = Client::create('https://service-url', 'escher_key', 'escher_secret'); | ||
$client->setLogger(new Logger('name')); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "emartech/session-validator-client", | ||
"description": "PHP client for Emarsys session validator service", | ||
"homepage": "https://github.com/emartech/session-validator-client-php", | ||
"authors": [ | ||
{ | ||
"name": "Emarsys Technologies", | ||
"homepage": "https://www.emarsys.com/", | ||
"role": "company" | ||
} | ||
], | ||
"license": [ | ||
"MIT" | ||
], | ||
"type": "library", | ||
"autoload": { | ||
"psr-4": { | ||
"SessionValidator\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Test\\SessionValidator\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=5.6", | ||
"emartech/escher": "^1.1", | ||
"guzzlehttp/guzzle": "^6.3", | ||
"psr/log": "^1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.7", | ||
"squizlabs/php_codesniffer": "^3.3" | ||
}, | ||
"suggest": { | ||
"ext-apcu": "Needed to support APC cache" | ||
}, | ||
"scripts": { | ||
"style": "vendor/bin/phpcs --standard=PSR2 src/ tests/", | ||
"test": "vendor/bin/phpunit --bootstrap=vendor/autoload.php tests/" | ||
} | ||
} |
Oops, something went wrong.