laravel-ready/ultimate-support
Ultimate Support
Support collection for Laravel. This package is standalone and does not require external packages.
Install
Install via Composer:
composer require laravel-ready/ultimate-support
Publish Config
php artisan vendor:publish --tag=ultimate-support-config
Support Classes
IpSupport
Contains methods for working with IP addresses.
use LaravelReady\UltimateSupport\Supports\IpSupport;
| Method | Description | Result |
|---|---|---|
| isLocalhost | Check client is from localhost | boolean |
| getPublicIp | Get client public IP address if it is localhost | null or string |
| getIpAddress | Get client real IP address | array |
getIpAddress Result
[
"is_local" => true, // is client from localhost
"base_ip" => "127.0.0.1", // laravel's request()->ip()
"ip_address" => "111.111.111.111", // real client ip
]
Warning
getPublicIpis uses ipify.org service and caching results for 1 day. Note In laravel native way you can useRequest::ip()method but this method is not cover all cases. For example cloudflare, nginx, etc. Also see this stackoverflow question.
Related Packages
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.0.0 | ^8.2 | | ^12.10 | | MIT | |
| v2.0.0 | ^8.2 | | ^11.8 | | MIT | |
| v1.1.1 | ^8.1 | | ^10.0 | | MIT | |
| v1.1.0 | ^8.0.2 | ^9.0 | MIT | |
| 1.0.2 | ^8.0.2 | ^9.0 | MIT | |
| 1.0.1 | ^8.0.2 | ^9.0 | MIT | |
| 1.0.0 | ^8.0.2 | ^9.0 | MIT |