Skip to content

Commit

Permalink
docs: added documentation for command line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
SRWieZ committed Dec 9, 2024
1 parent 4bc917d commit 6fc1dc7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,32 @@ $ipv4 = (new DigFetcher)->from(DnsProvider::Cloudflare)->fetch(IpVersion::v4);

Note that this returns null instead of throwing an exception if the fetcher fails.

## 📚 Use in command line

You can also use this library in the command line by using the `publicip` command.

It's recommended to install the library globally to use it in the command line.
```bash
composer global require knotsphp/publicip
```

Then you can use the `publicip` command to get the public IP address of the current machine.
```bash
# In your project directory
vendor/bin/publicip

# Globally installed
publicip

# To get the IPv4 address
publicip --ipv4
publicip -4

# To get the IPv6 address
publicip --ipv6
publicip -6
```

## 🏃 Performance

If you are sure that your machine has `dig` installed, you can speed up the process by setting the `isSupported`
Expand Down

0 comments on commit 6fc1dc7

Please sign in to comment.