webignition / sfs-client
HTTP client for querying api.stopforumspam.com
Requires
- php: >=7.2.0
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.3
- psr/http-message: ^1.0
- webignition/sfs-result-factory: >=0.1,<1
Requires (Dev)
- phpstan/phpstan: ^0.11.5
- phpunit/phpunit: ^8.1
- squizlabs/php_codesniffer: ^3
This package is auto-updated.
Last update: 2024-12-13 04:53:18 UTC
README
PHP HTTP client for querying api.stopforumspam.com.
Installation
composer require webignition/sfs-client
api.stopformumspam.com overview
api.stopforumspam.com can be queried by email address, email hash, ip address or username. Optional flags can be provided to influence what types of results are returned.
Read the api.stopforumspam.com usage guide first if unfamiliar.
Usage
- create client
- optionally create a request if not using a single-value convenience method
- query for results
Quick Usage Example
use webignition\SfsClient\Client; use webignition\SfsResultInterfaces\ResultInterface; $client = new Cient(); // Query against a single email address $result = $client->queryEmail('user@example.com'); // $result will be NULL if the HTTP request to query api.stopforumspam.com failed for any reason if ($result instanceof ResultInterface) { $result->getType(); // 'email', 'emailHash', 'ip' or 'username' $result->getFrequency(); // int $result->getAppears(); // bool $result->getValue(); // the email address, email hash, IP address or username $result->getLastSeen() // \DateTime()|null $result->getConfidence() // float|null $result->getDelegatedCountryCode(); // string|null $result->getCountryCode(); // string|null $result->getAsn(); // int|null $result->isBlacklisted(); // bool $result->isTorExitNode(); // bool|null }
Read more about creating requests and querying.
Understanding and Analysing Results
You probably want to know if a given email address/IP address/username can be trusted to perform an operation within your application.
See webignition/sfs-result-analyser for help with that.
See Also
Use webignition/sfs-querier for a package that contains webignition/sfs-result-analyser, webignition/sfs-client and provides detailed usage instructions.