PHPackages                             ipsquads/php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ipsquads/php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ipsquads/php
============

IPSquads official PHP library for IP Address Geolocation, Timezone, Currency, Network &amp; other information.

1.0.4(5y ago)18MITPHPPHP ^7.1.3

Since Oct 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/IPSquads/php)[ Packagist](https://packagist.org/packages/ipsquads/php)[ Docs](https://github.com/ipsquads/php)[ RSS](/packages/ipsquads-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (6)Used By (0)

PHP Library for IP Address Geolocation, Timezone, Currency &amp; other information.
===================================================================================

[](#php-library-for-ip-address-geolocation-timezone-currency--other-information)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c9dbc149948717c56aef11592aca81dc63840c3418ee935b279959936e095bbb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69707371756164732f7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ipsquads/php)[![Tests](https://github.com/IPSquads/php/workflows/Tests/badge.svg?branch=master)](https://github.com/IPSquads/php/workflows/Tests/badge.svg?branch=master)[![Total Downloads](https://camo.githubusercontent.com/ae7e90f6bf22a5a1c5c6aabf3bd0ebbb1878a36ce9c0346fccb08c504d9a7aa3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69707371756164732f7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ipsquads/php)

IPSquads PHP library for IP Address Geolocation, Timezone, Currency &amp; other information.

How companies are using IP Squads API?
--------------------------------------

[](#how-companies-are-using-ip-squads-api)

IPSquads is helping many companies &amp; organizations for various use-cases:

- Content Localization
- Analytics
- Fraud Prevention
- Targeted online advertising
- Geographic rights management

Getting Started
---------------

[](#getting-started)

By default, requests are throttled at 20 requests per minute if access key is not passed. You can remove this throttle limit by getting a FREE access key through which you can make 1000 unthrottled requests per day.

If you are a non-profit organization, you may request to increase this limit. You can drop us a mail at .

If you would like to upgrade for more than 1000 requests per day, you may select the plan here:

Installation
------------

[](#installation)

In-order to get started,

You can install the package via composer:

```
composer require ipsquads/php
```

Usage
-----

[](#usage)

To get all the details of an IP Address.

```
use Ipsquads\Php\IPSquads;
$access_key = 'FREE';
$ip_squads = new IPSquads($access_key);
$ip_data = $ip_squads->getDetails('54.70.143.245');
```

JSON Representation
-------------------

[](#json-representation)

```
{
  "ip_address": "54.70.143.245",
  "ip_type": "IPv4",
  "country_name": "United States",
  "country_code": "US",
  "country_languages": "en-US,es-US,haw,fr",
  "continent_code": "NA",
  "continent_name": "North America",
  "city": "Boardman",
  "zip": "97818",
  "region_name": "Oregon",
  "region_code": "USOR",
  "latitude": 45.83986,
  "longitude": -119.70058,
  "asn": {
    "asn": 16509,
    "asn_org": "AMAZON-02"
  },
  "location": {
    "is_eu": false,
    "postal_regex": "^d{5}(-d{4})?$",
    "capital": "Washington",
    "calling_code": "1"
  },
  "timezone": {
    "code": "America/Los_Angeles",
    "dst_offset": -7,
    "gmt_offset": -8,
    "current_time": "2020-10-12T22:52:09.911223+05:30",
    "current_time_unix": "1602523329.911223"
  },
  "currency": {
    "name": "Dollar",
    "code": "USD"
  }
}
```

### To get only the currency details

[](#to-get-only-the-currency-details)

If you are interested in only currency details, you can use the below method.

```
use Ipsquads\Php\IPSquads;
$access_key = 'FREE';
$ip_squads = new IPSquads($access_key);
$ip_data = $ip_squads->getCurrencyDetails('54.70.143.245');
```

### To get only the timezone details

[](#to-get-only-the-timezone-details)

If you are interested in only getting the timezone details of a visitor based on the IP Address, you can do that using the below method.

```
use Ipsquads\Php\IPSquads;
$access_key = 'FREE';
$ip_squads = new IPSquads($access_key);
$ip_data = $ip_squads->getTimezoneDetails('54.70.143.245');
```

### To get only the network details

[](#to-get-only-the-network-details)

If you are only looking for the network details of an IP Address, you can do using the below method.

```
use Ipsquads\Php\IPSquads;
$access_key = 'FREE';
$ip_squads = new IPSquads($access_key);
$ip_data = $ip_squads->getNetworkDetails('54.70.143.245');
```

Caching
-------

[](#caching)

By default, any result returned from IPSquads server are cached for quick access &amp; prevent you from using more credits unnecessarily.

Under the hood, this SDK uses [symfony/cache](https://github.com/symfony/cache) library for caching.

The default TTL of cache is 3600 seconds. If you would like to increase or decrease this limit, you can do so by modifying the way IPSquads is getting initialized.

```
use Ipsquads\Php\IPSquads;
$access_key = 'FREE';
$settings = [
  'expires_after' => '1000'
];
$ip_squads = new IPSquads($access_key, $settings);
```

### Cache adapter

[](#cache-adapter)

As a default, FilesystemAdapter cache is used. If you would like to use any other adapter of symfony/cache library, you can do so by passing the instance of a Cache Adapter. To check the available cache adapters, [click here](https://symfony.com/doc/current/components/cache.html#available-cache-adapters).

```
use Ipsquads\Php\IPSquads;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
$access_key = 'FREE';
$settings = [
  'cache_adapter' => (new ApcuAdapter)
];
$ip_squads = new IPSquads($access_key, $settings);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Sdklab007](https://github.com/Sdklab007)
- [All Contributors](../../contributors)

License
-------

[](#license)

The Apache License. Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

2038d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0bfcfc4bf39c235fd315ca5c69e401fc5dcef3b8ea75f213cd210a5e102bb602?d=identicon)[sdklab007](/maintainers/sdklab007)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (28 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (23 commits)")[![irfanm96](https://avatars.githubusercontent.com/u/42065936?v=4)](https://github.com/irfanm96 "irfanm96 (2 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (2 commits)")[![pforret](https://avatars.githubusercontent.com/u/474312?v=4)](https://github.com/pforret "pforret (2 commits)")[![sdklab007](https://avatars.githubusercontent.com/u/13796685?v=4)](https://github.com/sdklab007 "sdklab007 (2 commits)")[![weerd](https://avatars.githubusercontent.com/u/105849?v=4)](https://github.com/weerd "weerd (1 commits)")

---

Tags

ipdatabaseipgeolocationipinfoiplookup-phpphpipsquads

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ipsquads-php/health.svg)

```
[![Health](https://phpackages.com/badges/ipsquads-php/health.svg)](https://phpackages.com/packages/ipsquads-php)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
