matthewbdaly / akismet-client
Akismet PHP client
0.1.0
2018-01-09 23:14 UTC
Requires
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.0
- php-http/message-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^1.0
- php-http/message: ^1.0
- php-http/mock-client: ^1.0
- phpspec/phpspec: ^3.2
- psy/psysh: ^0.8.0
- squizlabs/php_codesniffer: ^2.7
This package is auto-updated.
Last update: 2024-10-28 07:39:34 UTC
README
A PHP client for the Akismet spam detection service. Built using modern practices and with an extensive test suite.
Installation
Install it with the following command:
composer require matthewbdaly/akismet-client
This library use HTTPlug, so you will also need to install a client implementation as specified here in order to actually use this client.
Usage
The client offers the following methds:
setKey($key)
- Sets the API keygetKey()
- Gets the API keysetBlog($blog)
- Sets the blog URLgetBlog()
- Gets the blog URLsetIp($ip)
- Sets the user IP addressgetIp()
- Gets the user IP addresssetAgent($agent)
- Sets the user agent stringgetAgent()
- Gets the user agent stringsetReferrer($referrer)
- Sets the referrer URLgetReferrer()
- Gets the referrer URLsetPermalink($permalink)
- Sets the permalink to the postgetPermalink()
- Gets the permalink to the postsetCommentType($type)
- Sets the comment type - can becomment
,forum-post
,reply
,blog-post
,contact-form
,signup
,message
or a custom typegetCommentType()
- Gets the comment typesetCommentAuthor($author)
- Sets the comment authorgetCommentAuthor()
- Gets the comment authorsetCommentAuthorEmail($email)
- Sets the comment author emailgetCommentAuthorEmail()
- Gets the comment author emailsetCommentAuthorUrl($url)
- Sets the comment author urlgetCommentAuthorUrl()
- Gets the comment author urlsetCommentContent($content)
- Sets the comment contentgetCommentContent()
- Gets the comment contentsetCommentDateGMT($date)
- Sets the comment dategetCommentDate()
- Gets the comment datesetCommentPostModifiedDate($date)
- Sets the comment modified dategetCommentPostModifiedDate()
- Gets the comment modified datesetBlogLang($lang)
- Sets the blog languagegetBlogLang()
- Gets the blog languagesetBlogCharset($charset)
- Sets the blog charsetgetBlogCharset()
- Gets the blog charsetsetUserRole($role)
- Sets the user rolegetUserRole()
- Gets the user rolesetIsTest($test)
- Sets whether this is a testgetIsTest()
- Gets whether this is a testflush()
- Flush all the existing valuesverifyKey()
- Verify the currently set API keycheck()
- Check the currently set comment to see if it is spamspam()
- Submit comment to Akisment as spamham()
- Submit comment to Akisment as hamsetParams(array $params)
- Set parameters in bulk
All of the set()
methods and the flush()
method are chainable, so you can do something like this:
$client->setParams($params)
->setCommentType('comment')
->setCommentAuthor('Bob Smith')
->check();
Note that verifyKey()
, check()
, ham()
and spam()
do not flush the parameters, so ensure you do so before starting a new request.