PHPackages                             xbnz/laravel-multi-api - 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. [API Development](/categories/api)
4. /
5. xbnz/laravel-multi-api

ActiveLibrary[API Development](/categories/api)

xbnz/laravel-multi-api
======================

Asynchronous API wrapper with proxy and multiple key support for Laravel

2.0.2(3y ago)3122MITPHP

Since Oct 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/XbNz/laravel-multi-api)[ Packagist](https://packagist.org/packages/xbnz/laravel-multi-api)[ RSS](/packages/xbnz-laravel-multi-api/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (5)Dependencies (19)Versions (9)Used By (0)

[![GitHub Workflow Status](https://camo.githubusercontent.com/b7281c64e3f35587ea6400c917e1fce81913cc93dac2339cc4624ec6849f8243/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f78626e7a2f6c61726176656c2d6d756c74692d6170692f52756e25323074657374733f6c6162656c3d5465737473267374796c653d666f722d7468652d6261646765266c6f676f3d6170707665796f72)](https://camo.githubusercontent.com/b7281c64e3f35587ea6400c917e1fce81913cc93dac2339cc4624ec6849f8243/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f78626e7a2f6c61726176656c2d6d756c74692d6170692f52756e25323074657374733f6c6162656c3d5465737473267374796c653d666f722d7468652d6261646765266c6f676f3d6170707665796f72)

Laravel Multi API
=================

[](#laravel-multi-api)

Supported APIs
--------------

[](#supported-apis)

ProviderKey requiredNormalized ObjectAbstractapi.com✅NormalizedGeolocationResultsData::classAbuseipdb.com✅NormalizedGeolocationResultsData::classIpapi.co❌NormalizedGeolocationResultsData::classIpapi.com✅NormalizedGeolocationResultsData::classIp-api.com❌NormalizedGeolocationResultsData::classIpdata.co✅NormalizedGeolocationResultsData::classIpgeolocation.io✅NormalizedGeolocationResultsData::classIpinfo.io✅NormalizedGeolocationResultsData::classMtr.sh: ping❌MtrDotShPingResultsData::classMtr.sh: mtr❌MtrDotShMtrResultsData::classInstallation
------------

[](#installation)

```
composer require xbnz/laravel-multi-api
```

Ensure that your composer.json file tells Laravel to auto-wire package service providers to your project:

```
"extra": {
  "laravel": {
    "dont-discover": []
  }
},
```

### The config files

[](#the-config-files)

- Publish config files:

```
php artisan vendor:publish --tag=ip-resolver
php artisan vendor:publish --tag=resolver
```

```
// resolver.php

'use_proxy' => (bool),
'proxies' => (array), // https://13.44.34.34:8080, https://user:pass@33.22.55.66:8080

'timeout' => (int), // seconds
'cache_period' => (int) //seconds,

'async_concurrent_requests' => (int),

'use_retries' => (bool),
'tries' => (int),
'retry_sleep' => (float), // seconds
'retry_sleep_multiplier' => (float) // seconds,
```

```
// ip-resolver.php

'api-keys' => (array),

/**
  * IpGeolocationDotIoDriver::class => [env(KEY_1), env(KEY_2), ...],
 */

/**
 * Visit https://mtr.sh/probes.json to retrieve the list of probe IDs
 */
\XbNz\Resolver\Domain\Ip\Drivers\MtrDotShMtrDriver::class => [
    'search' => (array)
],

\XbNz\Resolver\Domain\Ip\Drivers\MtrDotShPingDriver::class => [
    'search' => (array)
],
```

### Support for multiple API keys

[](#support-for-multiple-api-keys)

You may configure each driver in the config files with multiple API keys. API keys will be chosen randomly per HTTP request. If you have elected to use retry functionality, the key will be rehydrated on every try.

Caching
-------

[](#caching)

Caching is enforced by default as the alternative with exhaust your rate limiting very quickly. If you are using a time-sensitive service, use Laravel's Config facade to reduce caching before your API call.

```
Config::set(['resolver.cache_period' => 1]);
```

### Proxies

[](#proxies)

HTTP, HTTPS, SOCKS supported. Please use the URL structure denoted above. If you have elected to use retry functionality, the proxy will be rehydrated on every try.

### API downtime can disrupt your app. Plan ahead.

[](#api-downtime-can-disrupt-your-app-plan-ahead)

[![Geolocation php (11)](https://user-images.githubusercontent.com/12668624/164264570-a9b99a4c-e01d-4690-8562-865654d21dc2.png)](https://user-images.githubusercontent.com/12668624/164264570-a9b99a4c-e01d-4690-8562-865654d21dc2.png)

Geolocation
-----------

[](#geolocation)

The **minimum** normalized response you can expect from each IP API. Note there may be null values, refer to NormalizedGeolocationResultsData::class for structure.

- IP address quried
- Country
- City
- Latitude
- Longitude
- Organization/ISP

[![New Project (1)](https://user-images.githubusercontent.com/12668624/164261181-992717ad-e556-4d80-92ac-56e7bb18e40a.png)](https://user-images.githubusercontent.com/12668624/164261181-992717ad-e556-4d80-92ac-56e7bb18e40a.png)

### Combining all of your APIs

[](#combining-all-of-your-apis)

You can receive complete information for an IP using all of your APIs to put together a comprehensive report. Increase your async value in the `resolver.php` config file to expedite the process if you have many IPs and drivers.

```
public function example(Resolver $resolver)
{
	$result = $resolver
	    ->ip()
	    ->withIps(['8.8.8.8', '2606:4700:4700::1111'])
	    ->ipGeolocationDotIo()
	    ->ipApiDotCom()
	    ->ipInfoDotIo()
	    ->normalize();
	// ...

}
```

### Raw API output

[](#raw-api-output)

If you do not wish to receive condensed, normalized information, you may use the raw method:

```
public function example(Resolver $resolver)
{
	$result = $resolver
        ->ip()
        ->withIps(['8.8.8.8', '2606:4700:4700::1111'])
        ->ipGeolocationDotIo()
        ->ipApiDotCom()
        ->ipInfoDotIo()
        ->raw();
    // ...
}
```

ℹ️ This works in the same way as normalize(). Keep in mind there is no guarantee of data integrity with this option, the result is returned directly from the API in most cases.### Alternative to chaining

[](#alternative-to-chaining)

```
public function example(Resolver $resolver)
{
    $result = $resolver
        ->ip()
        ->withIps(['8.8.8.8', '2606:4700:4700::1111'])
        ->withDrivers([
            IpGeolocationDotIoDriver::class,
            // other drivers...
        ])
        ->normalize();
    // ...
}
```

### Downtime monitoring with the MTR.sh API

[](#downtime-monitoring-with-the-mtrsh-api)

MTR.sh is a Looking Glass API that gives you access to hundreds of networks around the world. This is particularly useful for downtime monitoring. The problem with the MTR.sh API is that the result is not friendly for programming languages. This is no longer the case for Laravel developers.

#### MTR.sh search term examples:

[](#mtrsh-search-term-examples)

Choose what MTR.sh networks you would like to use

Search typeSearch termCountry`['Germany', 'Brazil', 'Canada']`City`['Frankfurt', 'Rio', 'Toronto']`Continent`['Europe', 'South America', 'North America']`UN/LOCODE`['defra', 'brrio', 'cator']`ISP`['G-Core Labs', 'Anexia', 'Google']`For a complete list, visit

```
public function example(Resolver $resolver)
{
    $result = $resolver
        ->ip()
        ->withIps(['1.1.1.1'])
        ->mtrDotShMtr()
        ->mtrDotShPing()
        ->normalize();
    // ...

}
```

ℹ️ Some MTR.sh probes may not support IPv6, or may not have some abilities, such as the ability to perform MTR tests. When you specify a search term, if no probes match the IP or test type capability, `MtrProbeNotFoundException::class` will be thrown[![New Project (2)](https://user-images.githubusercontent.com/12668624/164275491-eaf25b7d-da7a-4d7e-afb1-cc98772f7ec4.png)](https://user-images.githubusercontent.com/12668624/164275491-eaf25b7d-da7a-4d7e-afb1-cc98772f7ec4.png)

A quick word on the design
--------------------------

[](#a-quick-word-on-the-design)

If you would like to extend the package to support other APIs, please keep the following in mind:

- One driver per endpoint -- GET: : SomeApiGeoDriver::class -- POST: : SomeApiGeoBulkDriver::class
- `AuthStrategies` &amp; `RetryStrategies` are responsible for applying api key headers, paths and query params, not the driver.
- `Normalize()` functionality will only work if there is a `Mapper::class` that `supports()` the target `Driver::class`
- Mappers, Drivers, and Strategies are all registered in the `ResolverServiceProvider::class` &amp; `IpServiceProvider::class`
- New API categories like currency conversion API drivers will follow the same pattern: registered in a theoretical `CurrencyServiceProvider::class`

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

[](#contributing)

Pull requests and issues are welcome.

License
-------

[](#license)

[MIT](./LICENSE.md)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~52 days

Total

5

Last Release

1450d ago

Major Versions

1.1.0 → 2.0.02022-04-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/d1d0c762e6b039dcff7565dbf0e7c8ed640d835b4f0cd4912be34d812be68695?d=identicon)[XbNz](/maintainers/XbNz)

---

Top Contributors

[![XbNz](https://avatars.githubusercontent.com/u/12668624?v=4)](https://github.com/XbNz "XbNz (86 commits)")

---

Tags

downtimegeolocationlaravelmtr-shphpping

###  Code Quality

TestsPHPUnit

Code StyleECS

### Embed Badge

![Health badge](/badges/xbnz-laravel-multi-api/health.svg)

```
[![Health](https://phpackages.com/badges/xbnz-laravel-multi-api/health.svg)](https://phpackages.com/packages/xbnz-laravel-multi-api)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M367](/packages/laravel-zero-framework)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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