matthewbdaly / akismet-client
Akismet PHP client
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/matthewbdaly/akismet-client
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: 2025-09-28 09:35:19 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,messageor 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.