Skip to content

simonfranz/laravel-akismet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Akismet

Installation

Install this package with composer:

php composer.phar require nickurt/laravel-akismet:dev-master

Add the provider to config/app.php file

'nickurt\Akismet\ServiceProvider',

and the facade in the file

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

Copy the config files for the api

php artisan vendor:publish

Examples

Validate Key

if( \Akismet::validateKey() ) 
{
    // valid
}
else 
{
    // invalid
}

Set CommentAuthor Information

\Akismet::setCommentAuthor("John Doe")
    ->setCommentAuthorUrl("https://www.google.com")
    ->setCommentContent("It's me, John!")
    ->setCommentType('registration');
    // etc
    
// or
\Akismet::setCommentAuthor("John Doe");
\Akismet::setCommentAuthorUrl("https://www.google.com");
\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!
}

Use as standalone (without Laravel)

require_once __DIR__.'/../vendor/autoload.php';

use \nickurt\Akismet\Akismet;

$akismet = new Akismet();
$akismet->setApiKey('MY_API_KEY');
$akismet->setBlogUrl('https://www.google.com');
$akismet->setCommentAuthor('John Doe');

if( $akismet->isSpam() )
{
    // yes, i'm spam!
}

Tests

bin/phpunit nickurt/laravel-akismet/tests

About

Akismet for Laravel 5

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%