dlabs.cloud/laravel-trusted-ip

There is no license information available for the latest version (dev-master) of this package.

This is a package that allows validation of trusted IP Address in the fly even at run time

dev-master 2020-09-10 15:29 UTC

This package is auto-updated.

Last update: 2024-04-11 00:09:25 UTC


README

Allow only your trusted IP address access services in real time. Update and change data base values from the db layer intead of accessing .env every time.

Ths package is IPAware and allows you to restrict Ips else only allow Ips that have been registered.

Installation

Via Composer

To install via composer, run the following command in the root of your Laravel application:

$ composer require dlabs.cloud/laravel-trusted-ip

You will have to run php artisan migrate to run update your db.

Usage

If you wish you can create an alias for the middleware in the app kernel thats up to you though.

'trusted.ip.address' => \Dlabs\LaravelTrustedIp::class  

Although You can also directly call the class in you route.

You can then guard your route as you wish

Route::get('/trusted-ip', 'TestController@trustedIp')->middleware('trusted.ip.address');  

The trusted Ip also allow parameters to be passed to it.

Route::get('/trusted-ip', 'TestController@trustedIp')->middleware('trusted.ip.address: reliance');  *This will check if the client IP making the request matches the name **reliance** on the trusted IP table.*  

NB: If no param is passed to the middleware it will only validate if the client IP exist on the trusted_ip_address table.

If you think you will have many clients that will be hitting that end point you can pass multiple IP names.

Route::get('/trusted-ip', 'TestController@trustedIp')>middleware('trusted.ip.address:paystack,monify,interswitch');  

Interesting right?

Test

🙆🏿‍♂️😭😭😭😭😭😭😭😭😭😭😭
No test, zero test coverage. But coming soon.