Akismet for Laravel 5.7
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
config php-cs-fixer to psr2 rules Jun 14, 2017
src added events, validationrule, laravel 5.5+ support only Feb 12, 2018
.gitignore First commit May 27, 2015
README.md added support for laravel57 .. Sep 4, 2018
composer.json added support for laravel57 .. Sep 4, 2018


Laravel Akismet


Install this package with composer:

composer require nickurt/laravel-akismet

Add the provider to config/app.php file


and the facade in the file

'Akismet' => 'nickurt\Akismet\Facade',

Copy the config files for the api

php artisan vendor:publish --provider="nickurt\Akismet\ServiceProvider" --tag="config"


The Akismet information can be set with environment values in the .env file (or directly in the config/akismet.php file)



Validation Rule

You can use a hidden-field akismet in your Form-Request to validate if the request is valid

$validator = validator()->make(['akismet' => 'akismet'], ['akismet' => [new \nickurt\Akismet\Rules\AkismetRule(
    request()->input('email'), request()->input('name')

The AkismetRule requires a email and name parameter to validate the request.


You can listen to the IsSpam, ReportSpam and ReportHam events, e.g. if you want to log all the IsSpam-requests in your application

IsSpam Event

This event will be fired when the request contains spam nickurt\Akismet\Events\IsSpam

ReportSpam Event

This event will be fired when you succesfully reported spam nickurt\Akismet\Events\ReportSpam

ReportHam Event

This event will be fired when you succesfully reported ham nickurt\Akismet\Events\ReportHam

Custom Implementation

Validate Key
if( \Akismet::validateKey() ) {
    // valid
} else {
    // invalid
Set CommentAuthor Information
\Akismet::setCommentAuthor("John Doe")
    ->setCommentContent("It's me, John!")
    // etc
// or
\Akismet::setCommentAuthor("John Doe");
\Akismet::setCommentContent("It's me, John!");
// etc
Get CommentAuthor Information
if( \Akismet::getCommentAuthor() == 'John Doe' ) {
    // it's me John!
Is it Spam?
if( \Akismet::isSpam() ) {
    // yes, i'm spam!
Submit Spam (missed spam)
if( \Akismet::reportSpam() ) {
    // yes, thanks!
Submit ham (false positives)
if( \Akismet::reportHam() ) {
    // yes, thanks!