PHP code example of cmdz / spam-canner

1. Go to this page and download the library: Download cmdz/spam-canner 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/ */

    

cmdz / spam-canner example snippets



$spamScoreIncrease = 1;
$currentCommentBody = 'abcd';
$previousCommentBody = 'abcd';

$testLink = 'http://www.site.de';
$spammyTlds = ['de'];
$domainParser = new \CmdZ\SpamCanner\Utilities\DomainParser;

$filters = [
  new BodyInPreviousComment($spamScoreIncrease, $currentCommentBody, $previousCommentBody),
  new Tlds($spamScoreIncrease, $testLink, $spammyTlds, $domainParser)
];

$utils = new \CmdZ\SpamCanner\Utilities\Utilities;
$score    = new Score($filters, $utils);
$result   = $score->getScore();
$expected = 2;