Akismet CodeIgniter Library

Basic PHP library for CodeIgniter to let you use Akismet to check messages for spam.

Example code:

$this->load->library('Akismet');

if($this->akismet->is_key_valid(array('key' => 'API-KEY-HERE'))){
	$this->akismet->set_key('API-KEY-HERE');
}

// the comment to check, see is_spam for full list
$comment = array(
	'comment_author'       => 'Auther',
	'comment_author_email' => 'nobody@example.com',
	'comment_author_url'   => 'http://www.example.com/',
	'comment_content'      => 'This is an example comment.'
);

// check the comment
if($this->akismet->is_spam($comment)) {
	echo 'The comment is spam.';
}

// mark it as spam
$this->akismet->mark_spam($comment);

// mark it as ham
$this->akismet->mark_ham($comment);

License: MIT
Download: PHP Akismet CodeIgniter Library

Comments