Laravel Akismet
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
if( \Akismet::validateKey() )
{
// valid
}
else
{
// invalid
}
\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
if( \Akismet::getCommentAuthor() == 'John Doe' )
{
// it's me John!
}
if( \Akismet::isSpam() )
{
// yes, i'm spam!
}
if( \Akismet::reportSpam() )
{
// yes, thanks!
}
if( \Akismet::reportHam() )
{
// yes, thanks!
}
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!
}
bin/phpunit nickurt/laravel-akismet/tests