PHPackages                             anik/apiz - 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. anik/apiz

ActivePhp[API Development](/categories/api)

anik/apiz
=========

Apiz is a boilerplate for REST API manager

v3.0(2y ago)58841MITPHPPHP ^8.0

Since Oct 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ssi-anik/apiz)[ Packagist](https://packagist.org/packages/anik/apiz)[ RSS](/packages/anik-apiz/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (13)Used By (0)

APIZ
====

[](#apiz)

APIZ is a PHP API Client Development Kit. You can easily handle all kind of JSON api response by using this package.

Requirements
------------

[](#requirements)

- PHP &gt;= 8

Installations
-------------

[](#installations)

```
composer require anik/apiz
```

Configurations
--------------

[](#configurations)

There are no extra configuration for this package.

Usage
-----

[](#usage)

Lets make a api service service for .

Suppose you have to make several api service for your package. Your service directory is `app/Services`. Now we are develop a service for  and make a class file `ReqResApiService.php`which is extend by `\Apiz\AbstractApi` class.

```
namespace App\Services;

use Apiz\AbstractApi;

class ReqResApiService extends AbstractApi
{
    protected function setBaseUrl() {
        return 'https://reqres.in';
    }
}
```

`AbstractApi` is a abstract class where `setBaseUrl()` is a abstract method.

To get API response from this url they've a prefix 'api' so first we set it with protected property `$prefix`

```
namespace App\Services;

use Apiz\AbstractApi;

class ReqResApiService extends AbstractApi
{
    protected function setBaseUrl() {
        return 'https://reqres.in';
    }

    protected function setPrefix () {
        return 'api';
    }
}
```

Now we make a method for get all users info

```
namespace App\Services;

use Apiz\AbstractApi;

class ReqResApiService extends AbstractApi
{
    protected function setBaseUrl()
    {
        return 'https://reqres.in';
    }

    protected function setPrefix () {
        return 'api';
    }

    public function allUsers()
    {
        $users = $this/*->query(['page'=>2])*/->get('/users');

        if ($users->getStatusCode() == 200) {
            return $users->parseJson();
        }

        return null;
    }
}
```

We use GuzzleHttp for this package. So you can easily use all HTTP verbs as a magic method. Its totally hassle free. with our all response we return three objects `response`, `request` and `contents`. You can access all Guzzle response method from this response. We are using magic method to access it from response.

#### Output

[](#output)

[![Response](https://camo.githubusercontent.com/a9cc0cfb825d2c9d0b893f77ee0b5e6d729e2c77fd440d96316b5f832dc84904/687474703a2f2f696d6775722e636f6d2f49674930764b622e706e673f31 "Response")](https://camo.githubusercontent.com/a9cc0cfb825d2c9d0b893f77ee0b5e6d729e2c77fd440d96316b5f832dc84904/687474703a2f2f696d6775722e636f6d2f49674930764b622e706e673f31)

Post Request with Form Params
-----------------------------

[](#post-request-with-form-params)

```
public function createUser(array $data)
{
    $user = $this->formParams($data)
            ->post('/create');

    if ($user->getStatusCode() == 201) {
        return $user->parseJson();
    }

    return null;
}
```

List of Parameter Options
-------------------------

[](#list-of-parameter-options)

- `formParams(array $params)`
- `headers(array $params)`
- `query(array $params)`
- `allowRedirects(array $params)`
- `auth(string $username, string $password [, array $options])`
- `body(array|string $contents)`
- `json(array $params)`
- `file(string $name, string $file_path, string $filename [, array $headers])`
- `attach (string $name, string $contents, string $filename [, array $headers])`
- `params(array $params)`

List of HTTP verbs
------------------

[](#list-of-http-verbs)

- `get(string $uri)`
- `post(string $uri)`
- `put(string $uri)`
- `delete(string $uri)`
- `head(string $uri)`
- `options(string $uri)`

Extra Methods
-------------

[](#extra-methods)

- `getGuzzleClient()`

Logging
-------

[](#logging)

Apiz allows you to log your Request and Response. It requires to configure a few methods.

- `logger()` return `\Psr\Log\LoggerInterface` **object**. Returning null will not log any data.
- `requestFormatter()` should return **object** satisfying `\Loguzz\Formatter\AbstractRequestFormatter` implementation. Returning null will not log request data.
- `responseFormatter()` should return **object** satisfying `\Loguzz\Formatter\AbstractResponseFormatter` implementation. Returning null will not log response data.
- `logRequestLength()` should return integer value. It's the length for a curl string while logging.
- `logOnlySuccessResponse()` returning `true` will only log successful response data if guzzle didn't raise any error.
- `logOnlyExceptionResponse()` returning `true` will only log error responses like connection timeout, response timeout.
- `logLevel()` can be set to any available log level.
- `tag()` should return non-empty string which will set the log to `["tag" => "log-message"]` format.
- `forceJson()` should return boolean value which will cast the message in JSON string if `true` otherwise as array when `false`. It's internally casted to boolean value.
- `useSeparator()` should return boolean value. Used with tag like `tag.request`, `tag.success`, `tag.failure`. It's internally casted to boolean value.

Available Request &amp; Response Formatters.
--------------------------------------------

[](#available-request--response-formatters)

FormatterAvailable ClassesRequest`\Loguzz\Formatter\RequestArrayFormatter`
 `\Loguzz\Formatter\RequestCurlFormatter`
 `\Loguzz\Formatter\RequestJsonFormatter`Response`\Loguzz\Formatter\ResponseArrayFormatter`
 `\Loguzz\Formatter\ResponseJsonFormatter`

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity74

Established project with proven stability

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

Recently: every ~300 days

Total

11

Last Release

901d ago

Major Versions

v1.2 → v2.02020-04-30

v2.8 → v3.02023-11-20

PHP version history (3 changes)v1.0PHP &gt;=5.5.9

v2.0PHP &gt;=7.1

v3.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7180f132fd7bfbbec2083528838f87996e01a6165ef50e58e2f3fcfccda1a834?d=identicon)[ssi-anik](/maintainers/ssi-anik)

---

Top Contributors

[![nahid](https://avatars.githubusercontent.com/u/3167309?v=4)](https://github.com/nahid "nahid (35 commits)")[![ssi-anik](https://avatars.githubusercontent.com/u/2676602?v=4)](https://github.com/ssi-anik "ssi-anik (35 commits)")[![sagar290](https://avatars.githubusercontent.com/u/7631656?v=4)](https://github.com/sagar290 "sagar290 (6 commits)")[![Shipu](https://avatars.githubusercontent.com/u/4118421?v=4)](https://github.com/Shipu "Shipu (1 commits)")[![thedevsaddam](https://avatars.githubusercontent.com/u/9676798?v=4)](https://github.com/thedevsaddam "thedevsaddam (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anik-apiz/health.svg)

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

###  Alternatives

[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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