vigstudio/akismet
Composer 安装命令:
composer require vigstudio/akismet
包简介
Akismet Library
README 文档
README
This is a PHP5 library that provides Akismet Spam Protection service functionality in your application.
Installation
The easiest way to install Akismet Library is via composer.
Create the following composer.json file and run the php composer.phar install command to install it.
{
"require": {
"openclassrooms/akismet": "*"
}
}
<?php require 'vendor/autoload.php'; use OpenClassrooms\Akismet\Services\AkismetService; //do things
Basic Usage
The AkismetServiceImpl class needs to set a client to communicate with Akismet Spam Protection service. This library provides a client based on GuzzleHttp\Client, though you can implement your own client. Then, you can set the client using the AkismetServiceImpl::setClient() method.
The Models
Comment
This Library defines a "Comment" interface which must be passed as an argument into the different AkismetService methods.
use OpenClassrooms\Akismet\Models\Comment; $comment = new CommentImpl();
Comment Builder
This library provides a Builder to create the Comment:
use OpenClassrooms\Akismet\Models\CommentBuilder; $comment = $commentBuilder->create() ->withUserIp(CommentStub::USER_IP) ->withUserAgent(CommentStub::USER_AGENT) ->withReferrer(CommentStub::REFERRER) ->withPermalink(CommentStub::PERMALINK) ->withAuthorName(CommentStub::AUTHOR_NAME) ->withAuthorEmail(CommentStub::AUTHOR_EMAIL) ->withContent(CommentStub::CONTENT) ->build();
Service
Use OpenClassrooms\Akismet\Services\Impl\AkismetServiceImpl; $akismetService = new AkismetServiceImpl(); // commentCheck method needs only one parameter, which has to be the Comment object if ($akismetService->commentCheck($comment)) { // store the comment and mark it as spam (in case of a misdiagnosis). } else { // store the comment normally }
to submit misdiagnosed spam and ham, which improves the system for everybody.
$akismetService->submitSpam($comment);
And
$akismetService->submitHam($comment);
Beyond this Library
If you plan to use Akismet Library in a Symfony2 project, check out the AkismetBundle. The bundle provides an easy configuration option for this library.
vigstudio/akismet 适用场景与选型建议
vigstudio/akismet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 12 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vigstudio/akismet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vigstudio/akismet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-12