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

AbandonedArchivedLibrary

grixu/api-client
================

Simple API Client with OAuth2 Auth handler

3.5.2(4y ago)01.1k1[6 PRs](https://github.com/grixu/api-client/pulls)1MITPHPPHP ^8.0

Since Dec 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/grixu/api-client)[ Packagist](https://packagist.org/packages/grixu/api-client)[ Docs](https://github.com/grixu/api-client)[ RSS](/packages/grixu-api-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (27)Used By (1)

API Client
==========

[](#api-client)

Simple API Client with OAuth2 Auth handler.

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

[](#installation)

You can install the package via composer:

```
composer require grixu/api-client
```

Usage for JSON API
------------------

[](#usage-for-json-api)

### Create configuration object

[](#create-configuration-object)

```
use Grixu\ApiClient\Config\JsonApiConfig;
use Grixu\ApiClient\Data\PaginatedData;
use Grixu\ApiClient\Data\StraightKeyParser;

$config =  new JsonApiConfig(
            baseUrl: 'http://rywal.com.pl',
            responseDataClass: PaginatedData::class,
            responseParserClass: StraightKeyParser::class,
            authType: 'oAuth2',  // or you can use enum: AuthType::OAUTH2()
            authUrl: 'http://rywal.com.pl',
            authData: ['key', 'secret'],
            paginationParam: 'page',
            filters: ['list', 'of', 'param', 'names', 'that', 'could', 'be', 'used', 'as', 'filters'],
            includes: ['same', 'but', 'for', 'includes'],
            sorts: ['same', 'this', 'time', 'for', 'sort', 'options']
        );
```

If you have various values of filter names, or extensive API to handle - consider creating Factory which will be handling creating `JsonApiConfig`. Or keep them in separate config file.

### Create fetcher

[](#create-fetcher)

```
use Grixu\ApiClient\JsonApiFetcher;

$fetcher = new JsonApiFetcher($config, '/api/path');
```

Here, you can adjust your query using `UrlCompose` by adding filters, sorts, includes:

```
// in every example you could pass multiple values
$fetcher->compose()->addFilter('filter_name', 'filter_value_1');
$fetcher->compose()->addInclude('include', 'include_relationship_1', 'include_relationship_2');
$fetcher->compose()->addSort('sort', 'sort_field');

//also you could set page in pagination
$fetcher->compose()->setPage('page', 2);
// or simply move to next page by hand
$fetcher->compose()->nextPage();
```

#### Fetch Data

[](#fetch-data)

```
$fetcher->fetch();
$parsedCollection = $parser->parse(DtoClass::class);
```

`$parsedCollection` is `\Illuminate\Support\Collection` filled with DTOs you

Configuration
-------------

[](#configuration)

You can adjust global configuration of APIClient in your `.env` file:

```
API_ERROR_LOGGING=true
API_ERROR_LOG_CHANNEL="api-client"
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mateusz Gostański](https://github.com/grixu)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 92.5% 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 ~18 days

Recently: every ~4 days

Total

19

Last Release

1641d ago

Major Versions

1.0.0 → 2.0.02021-01-04

2.0.1 → 3.0.02021-02-12

PHP version history (3 changes)1.0.0PHP ^7.4

2.0.1PHP ^7.4|^8.0

3.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/67002661?v=4)[Mateusz Gostański](/maintainers/grixu)[@grixu](https://github.com/grixu)

---

Top Contributors

[![grixu](https://avatars.githubusercontent.com/u/67002661?v=4)](https://github.com/grixu "grixu (37 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

api-clienthacktoberfestjson-api-clientapi clientgrixu

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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