Download the PHP package andrey-helldar/spammers without Composer
On this page you can find all versions of the php package andrey-helldar/spammers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andrey-helldar/spammers
More information about andrey-helldar/spammers
Files in andrey-helldar/spammers
Package spammers
Short Description Simple package to prevent accessing of spammers to Laravel application
License MIT
Informations about the package spammers
Spammers for Laravel 5.4+
Simple package to prevent accessing of spammers to Laravel application.
Installation
To get the latest version of this package, simply require the project using Composer:
Instead, you may of course manually update your require block and run composer update
if you so choose:
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
:
Helldar\Spammers\ServiceProvider::class,
Next, call php artisan vendor:publish
and php artisan migrate
commands after set up config/spammers.php file and install the migrations by running php artisan migrate
command.
Now, use spammer()
helper and Artisan commands.
Documentation
- Helpers Store
- Helpers Accessing
- Middleware
- Console Command
- Additional
- Simple Using
Helpers Store
Store IP-address in a spam-table:
spammer()
->ip('1.2.3.4')
->store();
// or
spammer('1.2.3.4')->store();
Delete IP-address from a spam-table:
spammer()
->ip('1.2.3.4')
->delete();
// or
spammer('1.2.3.4')->delete();
Restore IP-address from a spam-table:
spammer()
->ip('1.2.3.4')
->restore();
// or
spammer('1.2.3.4')->restore();
Check exists IP-address in a spam-table:
spammer()
->ip('1.2.3.4')
->exists();
// or
spammer('1.2.3.4')->exists();
Helpers Accessing
To save an IP address with the URL in the database, use the helper spammer()->access()
:
spammer()
->access()
->ip('1.2.3.4')
->url('/foo/bar')
->store();
// or
spammer('1.2.3.4')
->access()
->url('/foo/bar')
->store();
Ban when attempts to get pages with errors exceed a given number.
Example:
- When the number of attempts reaches
100
- ban for24
hours. - When the number of attempts reaches
300
- ban for72
hours. - When the number of attempts reaches
500
-permanent ban
.
Default, permanent ban
.
Middleware
Next, add link to middleware in $routeMiddleware
block in app/Http/Kernel.php
file, and use him in $middlewareGroups
blocks:
Or you can specify globally in the attribute $middleware
of the Http/Kernel.php
file:
Console Command
This package maybe called in a console:
spam:amnesty
spam:store 1.2.3.4
spam:delete 1.2.3.4
spam:restore 1.2.3.4
spam:exists 1.2.3.4
The spam:amnesty
command allows you to delete IP-addresses that have expired.
Additional
You can use a Helldar\Spammers\Models\Spammer
model. His extended Illuminate\Database\Eloquent\Model
.
Simple Using
You can specify globally in the attribute $middleware
of the Http/Kernel.php
file:
Next, in the report()
method of file app\Exceptions\Handler.php
, add the call to the spammer()->access()
helper:
And add a rule to the schedule()
method of the app/Console/Kernel.php
file:
Execute the commands:
Customize the file config/spammers.php
for your purposes.
Profit!
Copyright and License
Laravel Spammers was written by Andrey Helldar for the Laravel framework 5.4 or later, and is released under the MIT License. See the LICENSE file for details.
Translation
Translations of text and comment by Google Translate. Help with translation +1 in karma :)
All versions of spammers with dependencies
illuminate/console Version ^5.4|^6.0|^7.0|^8.0
illuminate/database Version ^5.4|^6.0|^7.0|^8.0
illuminate/http Version ^5.4|^6.0|^7.0|^8.0
illuminate/support Version ^5.4|^6.0|^7.0|^8.0
illuminate/validation Version ^5.4|^6.0|^7.0|^8.0
jaybizzle/laravel-crawler-detect Version ^1.2