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

ActiveLibrary

atog/simple-api-client
======================

Simple API Client with cUrl

v1.2.0(10y ago)0871MITPHPPHP &gt;=5.5

Since Apr 16Pushed 10y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (5)Versions (4)Used By (1)

simple-api-client
=================

[](#simple-api-client)

[![Latest Version on Packagist](https://camo.githubusercontent.com/eb0fa19ce8ac131882bfcc2d2ecfe48923bbdc930d0188f2be0a1f2d4575cc6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61746f672f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/atog/simple-api-client)[![GitHub license](https://camo.githubusercontent.com/7f9a56966ea41355c071fbcd77c6ae9fa67227a8ade693614f364ab9ae9ff80f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f50617363616c4b6c65696e6469656e73742f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/PascalKleindienst/simple-api-client/blob/master/LICENSE)[![Travis](https://camo.githubusercontent.com/f831bbbba3732e055dfd6c0bad8899710fc590089e508f439cb33058e391bf88/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f50617363616c4b6c65696e6469656e73742f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/PascalKleindienst/simple-api-client)[![HHVM](https://camo.githubusercontent.com/b4811d1cfdd60fca44cf8e31a4ec7247c56168850ad3cb522bc874ff5ef7eed4/68747470733a2f2f696d672e736869656c64732e696f2f6868766d2f61746f672f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](http://hhvm.h4cc.de/package/atog/simple-api-client)[![Quality Score](https://camo.githubusercontent.com/a27d8ba86e837af09b376be22237d5e408ddb2ee1c3914370638b78aeb6ae1ab/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f50617363616c4b6c65696e6469656e73742f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/PascalKleindienst/simple-api-client/?branch=master)[![Scrutinizer Coverage](https://camo.githubusercontent.com/67d4340f2110232c3d4c1f245aa73a54516e497eefa97d7cb70fc9f5133f3cf9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f50617363616c4b6c65696e6469656e73742f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/PascalKleindienst/simple-api-client/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/1acedf87db1527028882e7e915b8959bf5e6a3ce944e6b596944080d1859f220/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61746f672f73696d706c652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/atog/simple-api-client)

The simple-api-client library provides an easy way to build wrappers for public REST APIs.

Install
-------

[](#install)

Via Composer

```
$ composer require atog/simple-api-client
```

Usage
-----

[](#usage)

### Classes

[](#classes)

#### Client

[](#client)

The `Client` Class contains the basic Informations about the API liek the `$domain`. It has to extend the abstract class `Atog\Api\Client`

```
class Client extends \Atog\Api\Client
{
	protected $domain = 'http://example.com/api/v1';
}
```

#### Endpoints

[](#endpoints)

Endpoints provide the functions to query the resources of the API.

```
class TestEndpoint extends \Atog\Api\Endpoint
{
	protected $endpoint = 'foo';

	public function find($slug)
    {
        // https://example.com/api/v1/foo/$slug gets called
		$this->respond(
		    $this->client->get($this->getEndpointUrl($slug, true))
		);
    }
}
```

#### Models

[](#models)

The Models are the datastructures of the resources. Attributes can easly be changed with get and set mutators *(much like the Eloquent Mutators from Laravel: )*

```
class TestModel extends Model
{
    public function getNameAttribute($value)
    {
    	return strtoupper($value);
    }

    public function setFirstNameAttribute($value)
    {
    	$this->attributes['first_name'] = strtolower($value);
    }

    public function setContactsAttribute($value)
    {
    	$this->attributes['contacts'] = $this->makeCollection($value, Contacts::class);
    }
}
```

### Initialization

[](#initialization)

The first parameter defines all endpoints you are using. The second provides some options about the models or cUrl. In the models config we can bind a model to an endpoint

```
// new Client(array $endpoints, array $config = [])
$client = new Client(
    [
        TestEndpoint::class
    ],
    [
        'models' => [
            'TestEndpoint' => TestModel::class
        ],
        'curl' => [
            CURLOPT_TIMEOUT => 60
        ]
    ]
);
$foo = $client->testEndpoint->find(1); // GET http://example.com/api/v1/foo/1
```

Change log
----------

[](#change-log)

### 1.1.0

[](#110)

- added support for query params
- added helper method to return api reponse

### 1.0.0

[](#100)

- Initial Release

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3652d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/367c097ec42aec6ed007853fbec64d138734606e71574341f970e273b3efe7fd?d=identicon)[PascalKleindienst](/maintainers/PascalKleindienst)

---

Top Contributors

[![PascalKleindienst](https://avatars.githubusercontent.com/u/3470866?v=4)](https://github.com/PascalKleindienst "PascalKleindienst (40 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[livewire/livewire

A front-end framework for Laravel.

23.5k75.5M1.8k](/packages/livewire-livewire)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[laravel/sail

Docker files for running a basic Laravel application.

1.9k186.9M1.0k](/packages/laravel-sail)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)

PHPackages © 2026

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