Skip to content

Commit da7a22b

Browse files
committed
Update README.md
1 parent 59df6bb commit da7a22b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Install via Composer:
1818
composer require laravel-ready/ultimate-support
1919
```
2020

21+
## Publish Config
22+
23+
```bash
24+
php artisan vendor:publish --tag=ultimate-support-config
25+
```
26+
2127
# Support Classes
2228

2329
## IpSupport
@@ -29,8 +35,20 @@ Contains methods for working with IP addresses.
2935
| Method | Description | Result |
3036
| ------ | ----------- | ------ |
3137
| **isLocalhost** | Check client is from localhost | `boolean` |
32-
| **getLocalhostPublicIp** | Get client public IP address if it is localhost | `null` or `string` |
33-
| **getIP** | Get client real IP address | `string` |
38+
| **getPublicIp** | Get client public IP address if it is localhost | `null` or `string` |
39+
| **getIpAddress** | Get client real IP address | `array` |
40+
41+
### getIpAddress Result
42+
```php
43+
[
44+
"is_local" => true, // Is client from localhost
45+
"base_ip" => "127.0.0.1", // laravel's request()->ip()
46+
"ip_address" => "111.111.111.111", // real client ip
47+
]
48+
```
49+
50+
> **Warning** `getPublicIp` is uses [ipify.org](https://api.ipify.org/?format=json) service and caching results for 1 day.
51+
3452

3553
- The `getLocalhostPublicIp` method is useful for checking if the client is from localhost. Uses https://api.ipify.org/?format=json endpoint.
3654
- In laravel native way you can use `Request::ip()` method but this method is cover all cases. For example cloudflare, nginx, etc. Also see this stackoverflow [question](https://stackoverflow.com/q/13646690/6940144).

0 commit comments

Comments
 (0)