cmdz / spam-canner
Extensible Spam Detection Filters based on snook.ca post
0.2.1
2015-01-28 02:11 UTC
Requires
- php: >=5.4.0
- jeremykendall/php-domain-parser: 1.2.*
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-12-21 16:00:03 UTC
README
Extensible Spam Detection Filters based on this snook.ca post
Installation
Available on Packagist. Autoloading is PSR-4 compatible.
composer require cmdz/spam-canner
Usage
Filters are located in the src/Filters
directory.
You can add your own filters as well, they just need to implement CmdZ\SpamCanner\Filters\FilterInterface
and then add them
to the $filters
array that you pass to Score()
$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;
Available Filters
See snook.ca post for the ideas behind each filter.
- Body in Previous Comment
- Body Length
- Check Auth Name for Link
- Consonants
- First Word
- Links in Body
- Status of Previous Comment
- Tlds
- Url Length
- Words Characters in Url
Testing
$ phpunit
License
The MIT License (MIT). Please see the License File for more information.