PHPackages                             ladavinash17/api-client - 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. ladavinash17/api-client

ActiveLibrary

ladavinash17/api-client
=======================

Api client is PHP based HTTP Client used for hitting your api and getting response

010PHP

Since Dec 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ladavinash17/api-client)[ Packagist](https://packagist.org/packages/ladavinash17/api-client)[ RSS](/packages/ladavinash17-api-client/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

ApiClient, PHP HTTP client
==========================

[](#apiclient-php-http-client)

ApiClient is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services.

- Simple interface for building query strings, POST requests, uploading JSON data, etc...
- Abstracts away the underlying HTTP transport, allowing you to write environment and transport agnostic code; i.e., no hard dependency on cURL, PHP streams, sockets, or non-blocking event loops.

Installing ApiClient
--------------------

[](#installing-apiclient)

The recommended way to install ApiClient is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of Guzzle:

```
php composer.phar require guzzlehttp/guzzle
```

Next, run the Composer command to install the latest stable version of ApiClient:

```
php composer.phar require ladavinash17/api-client
```

You can then later update ApiClient using composer:

```
composer.phar update
```

User Guide
----------

[](#user-guide)

First you need to set few parameters which can be configured for different environments, projects.

In Symfony, for eg:

```
parameters:
    api_client:
        connection_timeout:   2.0
        allowed_methods:      ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']

        your_project_key:
            host:     "http://your-domain.com/"
            headers:
                #You can mention key-value pair here,
                # internal code will replace "_" with "-" in key
                token:  ThisIsYourSecretTokenForApiAuthorization
```

In above yaml file, `api_client`, `connection_timeout`, `allowed_methods`, `host`, `headers` are keywords which are to be used as it is. ApiClient reads those values based on those keys. `your_project_key` key is your own custom project key, You can change this as per your way.

To set those basic parameters you just need to pass the above array to ApiClient(). For Eg:

```
//$apiConfig is the array from the above parameters.yaml/api.yaml.
$apiConfig = $container->getParameter('api_client');
$apiClient = new ApiClient($apiConfig, 'your_project_key');
return $apiClient->get(
    '/v1/products',             // Route endpoint
    [],                         // url parameters to be replaced in route endpoint
    ['page'=> 1],               // query parameters
    ['x-total-count' => 'Yes']  // headers other than default set in parameters.yaml
);
```

It is not mandatory to use parameters.yaml only. You can keep those settings anywhere as per your framework, as per your convenience. You just need to pass the array in the same format for ApiClient to work properly.

In Project settings, `host` is mandatory, failing which the ApiClient will throw error. You just need to mention Base URI/Host name in `host`. `headers` is optional. But if you need to pass any headers by default with every request, you can set it here. Also you can pass headers in get(), post() etc functions also.

Note: ApiClient always applies 'accept' = 'application/json' and 'content-type' = 'application/json' in headers by default.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

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

---

Top Contributors

[![avinashlad](https://avatars.githubusercontent.com/u/3490877?v=4)](https://github.com/avinashlad "avinashlad (1 commits)")

### Embed Badge

![Health badge](/badges/ladavinash17-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/ladavinash17-api-client/health.svg)](https://phpackages.com/packages/ladavinash17-api-client)
```

PHPackages © 2026

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