PHP code example of fyrts / akismet

1. Go to this page and download the library: Download fyrts/akismet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fyrts / akismet example snippets


use Akismet\Akismet;
use Akismet\Comment;

// Instantiate API client with your API key and website root URL
$akismet = new Akismet('api-key', 'https://www.example.org');

// Define content to check for spam
$comment = new Comment();
$comment->setAuthor('Author Name')
        ->setAuthorEmail('[email protected]')
        ->setContent('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');

// Optionally 

$comment = new Comment([
    'comment_author' => 'Author Name',
    'comment_author_email' => '[email protected]',
    'comment_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
]);
$comment->

$result = $akismet->check([
    'comment_author' => 'Author Name',
    'comment_author_email' => '[email protected]',
    'comment_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
]);

$akismet->setLanguage('en');
$akismet->setCharset('UTF-8');
$akismet->