PHP code example of nickurt / laravel-akismet
1. Go to this page and download the library: Download nickurt/laravel-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/ */
nickurt / laravel-akismet example snippets
// FormRequest ...
public function rules()
{
return [
'akismet' => [new \nickurt\Akismet\Rules\AkismetRule(
request()->input('email'), request()->input('name')
)]
];
}
// Manually ...
$validator = validator()->make(['akismet' => 'akismet'], ['akismet' => [new \nickurt\Akismet\Rules\AkismetRule(
request()->input('email'), request()->input('name')
)]]);
if( \Akismet::validateKey() ) {
// valid
} else {
// invalid
}
\Akismet::setCommentAuthor("John Doe")
->setCommentAuthorUrl("https://www.google.com")
->setCommentContent("It's me, John!")
->setCommentType('registration');
// etc
// or
\Akismet::fill([
'comment_author' => 'John Doe',
'comment_author_url' => 'https://www.google.com',
'comment_content' => 'It's me, John!'
]);
// etc
if( \Akismet::isSpam() ) {
// yes, i'm spam!
}
if( \Akismet::reportSpam() ) {
// yes, thanks!
}
if( \Akismet::reportHam() ) {
// yes, thanks!
}
php artisan vendor:publish --provider="nickurt\Akismet\ServiceProvider" --tag="config"