My first Laravel Package is now available on Github: https://github.com/MadMikeyB/throttleable
Why?
Now, I know your first thought is of Graham Campbell's excellent Throttle package, however the reason I created this was that I needed something more lightweight and primarily database driven.
Additionally, I had the urge to create a Laravel Package as I had never created one before.
Package Info
Throttle requests to your application based on users IP address.
- Set a threshold on how many requests an IP address can make.
- Throttles expire after a configurable period of time.
- Throttles are unique per IP address.
- Configurable through
config/throttleable.php
Installation
Installation is much the same as any other Laravel Package, you simply require madmikeyb/throttleable from composer, and then run the required artisan commands to copy over the migration and config file.
Usage
The package is extremely simple to use, you import the Model which is provided by the package (which in turn uses the Throttleable trait for which the package is named) and call a check method on the Throttle Model.
More detailed usage is available in the README file on GitHub.