tvaliasek/simple-php-akismet
Composer 安装命令:
composer require tvaliasek/simple-php-akismet
包简介
Simple class for check comment or contact form spam against Akismet API
README 文档
README
Very simple modern PHP implementation of Akismet spam check service.
Install
composer require tvaliasek/simple-php-akismet
Use
use SimpleAkismet\Client; use SimpleAkismet\DataObject\Message; use SimpleAkismet\Exception\AkismetException; use SimpleAkismet\Exception\InvalidKeyException; use SimpleAkismet\Exception\InvalidStatusCodeException; /* * Client covers all four API methods: * verifyKey, checkSpam, submitSpam and submitHam */ $client = new Client( 'yourAkismetApiKey', 'https://www.example.com/', new \GuzzleHttp\Client() ); $message = (new Message()) ->setBlog('https://www.example.com/') ->setCommentAuthorEmail('john@doe.com') ->setCommentContent('Cheap viagra for sale on: www.foo.com') ->setCommentDateGmt(new \DateTime()); // all available fields has their own setter and getter try { if ($client->checkSpam($message)) { // do something with spam message } } catch (AkismetException | InvalidKeyException | InvalidStatusCodeException $e) { // ... }
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-06