1. Go to this page and download the library: Download flexic/spam-filter 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/ */
flexic / spam-filter example snippets
$spamFilter = new \Flexic\SpamFilter\SpamFilter([
new \Flexic\SpamFilter\Filter\BlacklistFilter([
'want to buy'
]),
new \Flexic\SpamFilter\Filter\RegexFilter([
'/\[\[url\=.*\]\]/'
])
]);
$spamFilter->check(
'Hello, how are you? Do you want to buy [[url=https://example.com/product]] this Product?'
); // Result: true (both filters detected spam)
$spamFilter->check(
'Hey my friend. Do you want to test a new PHP Library?'
); // Result: false (No filter detected spam)
class EmailFilter implements \Flexic\SpamFilter\Filter\FilterInterface
{
public function check($input): bool
{
\preg_match_all('/(([^ ].*)@(.*))/', $input, $matches, \PREG_SET_ORDER, 0);
if (\count($matches) > 0) {
return true;
}
return false;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.