Download the PHP package gam6itko/ipquery-client without Composer

On this page you can find all versions of the php package gam6itko/ipquery-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ipquery-client

php-ipquery-client

CI Latest Stable Version License

Framework-agnostic PHP client for a self-hosted IPQuery geo service: resolve country, ISP and risk data by IP address. Built on PSR-18 (HTTP client) and PSR-17 (HTTP factories), so it works with any PSR-7 implementation.

[!IMPORTANT] This client targets the self-hosted akyriako/ipquery server (endpoint GET /lookup/{ip}). It is NOT compatible with the public SaaS ipquery.io — that service has a different API (endpoints and response shape). For ipquery.io use one of these instead:

Installation

Usage

Endpoints

Method Server endpoint Returns
lookup(string $ip) GET /lookup/{ip} TIPQueryResult for the given IP
own() GET /own/all TIPQueryResult for the caller's own IP
ownIp() GET /own non-empty-string — the caller's own IP

own() / ownIp() live on IPQueryClient only; LookupInterface (the cacheable, mockable contract used via CachedIPQuery / IPQueryStub) exposes just lookup().

Error handling

Every failure throws an exception implementing Gam6itko\IPQuery\ExceptionInterface:

lookup() accepts both IPv4 and IPv6 — a string that is not a valid IP address is rejected up front with InvalidIpException (a LookupException, so existing catch blocks keep working). For an unexpected HTTP status the code is available via getStatusCode() (null for transport/parsing/ validation failures):

Caching

CachedIPQuery decorates any IPQueryInterface with a PSR-16 cache (the IP-to-country mapping changes rarely; failures are never cached):

Retrying transient failures

RetryingIPQuery decorates any LookupInterface and retries transient failures with exponential backoff — a transport error, a 5xx status, or 429. Deterministic failures (InvalidIpException, other 4xx) fail fast and are never retried:

Override which failures are retried via the $retryable callback (\Closure(LookupException $e, int $attempt): bool).

Testing

Use IPQueryStub as a test double — it returns a canned result or throws a given exception:

Response contract

lookup() returns the decoded /lookup/{ip} payload (psalm type TIPQueryResult):

Key Shape
ip string
isp {asn, org, isp}
location {country, country_code, city, state, zipcode, latitude, longitude, timezone, localtime}
risk {abuse_confidence_score, usage_type, is_tor, total_reports, number_of_users_reported, last_reported_at}

Development

License

MIT — see LICENSE.


All versions of ipquery-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
psr/http-client Version ^1.0.3
psr/http-factory Version ^1.1
psr/http-message Version ^1.1 || ^2.0
psr/simple-cache Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gam6itko/ipquery-client contains the following files

Loading the files please wait ...