Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-akismet

> 后端框架
Open source

Akismet for Laravel 11.x/12.x/13.x

99 stars0 likes2 views
WebsiteGitHub

About

Akismet for Laravel 11.x/12.x/13.x

Laravel Akismet

Installation

Install this package with composer:

composer require nickurt/laravel-akismet

Copy the config files for the api

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

Configuration

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

AKISMET_APIKEY=MY_UNIQUE_APIKEY
AKISMET_BLOGURL=https://my-custom-blogurl.dev

Examples

Validation Rule

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

php
// FormRequest ...

public function rules()
{
    return [
        'akismet' => [new \nickurt\Akismet\Rules\AkismetRule(
            request()->input('email'), request()->input('name')
        )]
    ];
}

// Manually ...

$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.

Events

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
php
if( \Akismet::validateKey() ) {
    // valid
} else {
    // invalid
}
Set CommentAuthor Information
php
\Akismet::setCommentAuthor("John Doe")
    ->setCommentAuthorUrl("https://www.google.com")
    ->setCommentContent("It's me, John!")
    ->setCommentType('registration');
    // etc
    
// or
\Akismet::fill([
    'comment_author' => 'John Doe',
    'comment_author_url' => 'https://www.google.com',
    'comment_content' => 'It's me, John!'
]);
// etc
Is it Spam?
php
if( \Akismet::isSpam() ) {
    // yes, i'm spam!
}
Submit Spam (missed spam)
php
if( \Akismet::reportSpam() ) {
    // yes, thanks!
}
Submit Ham (false positives)
php
if( \Akismet::reportHam() ) {
    // yes, thanks!
}

Tests

bash
composer test

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPakismetlaravellaravel-akismetspam

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架