eman1986/larakismet

This package is abandoned and no longer maintained. The author suggests using the nickurt/laravel-akismet package instead.

Akismet Client for Laravel 5

1.0.3 2015-05-27 17:36 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:47:54 UTC


README

Total Downloads Latest Stable Version Latest Unstable Version License

Akismet Client for Laravel 5.

#Installation

simply include this library to your app's composer.json file in the request block:

"require": {
    "eman1986/larakismet": "dev-master",
}

Once you have the package loaded into your application's file system, open the config/app.php file and add the following line to the 'providers' array:

'larakismet\ServiceProviders\AkismetServiceProvider'

Add the facade of this package to the $aliases array.

'Akismet' => 'larakismet\Facades\Akismet'

run the following command in your terminal:

php artisan vendor:publish

This will create a config file for you where you can enter in the API Key (which if you don't have one, you'll need one, visit https://akismet.com) and enter in the address of your blog. You can also setup a debug mode to just test out the akismet API.

#What's Next?

After everything is all configured, you can now use the code in your application.

##checkSpam()

This will allow you to run a check on a comment post and ensure its not spam.

Akismet likes to have as much information as possible to properly determine if something is indeed Spam.

If you were to read the Akismet API on this, they ask for a lot of things but at a minimal you'll need the following set:

\Akismet::setCommentAuthor('John Doe');
\Akismet::setCommentAuthorEmail('email@example.com');
\Akismet::setPermalink('http://somesite.com/blog/sample-entry');
\Akismet::setCommentContent('Some content from form.');
\Akismet::checkSpam();

If you check out the source code you can see the other options available to zero in on the spammer, the Akismet API Guide is also a good reference..

##reportSpam()

You can help Akismet tackle spam by reporting it to them, this requires a smaller set of dat compared to the checkSpam() method.

\Akismet::setCommentAuthor('John Doe');
\Akismet::setCommentAuthorEmail('email@example.com');
\Akismet::setPermalink('http://somesite.com/blog/sample-entry');
\Akismet::setCommentContent('Some content from form.');
\Akismet::reportSpam();

##reportHam()

You can also report false positives to Akismet by doing the following:

\Akismet::setCommentAuthor('John Doe');
\Akismet::setCommentAuthorEmail('email@example.com');
\Akismet::setPermalink('http://somesite.com/blog/sample-entry');
\Akismet::setCommentContent('Some content from form.');
\Akismet::reportHam();

ReportSpam() & reportHam() will accept the same parameters. Using these two methods will help make the web a better place for all of us.

#Questions?

If you need help, please let me know and I'll be happy to assist.