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

ActiveLibrary[API Development](/categories/api)

somnambulist/api-client
=======================

A library to help ease creating API integrations

4.1.1(1y ago)13.1k↓100%1MITPHPPHP &gt;=8.1

Since Dec 4Pushed 1y ago3 watchersCompare

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

READMEChangelogDependencies (14)Versions (41)Used By (1)

Somnambulist API Client Library
===============================

[](#somnambulist-api-client-library)

[![GitHub Actions Build Status](https://camo.githubusercontent.com/e1b1863985f7b224d4cb8e41da27f744737320bc224da375fb12e0837eb8d324/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736f6d6e616d62756c6973742d746563682f6170692d636c69656e742f74657374732e796d6c3f6c6f676f3d676974687562266272616e63683d6d6173746572)](https://github.com/somnambulist-tech/api-client/actions?query=workflow%3Atests)[![Issues](https://camo.githubusercontent.com/52d1eed9b5b43afdb91ac36dde6341e5b61b10d81c3138084e0eaab0436f8c42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f736f6d6e616d62756c6973742d746563682f6170692d636c69656e743f6c6f676f3d676974687562)](https://github.com/somnambulist-tech/api-client/issues)[![License](https://camo.githubusercontent.com/53bd16982414ad1318abbe641af39f9f96071a02b833b07489538d1b14cd2eb7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736f6d6e616d62756c6973742d746563682f6170692d636c69656e743f6c6f676f3d676974687562)](https://github.com/somnambulist-tech/api-client/blob/master/LICENSE)[![PHP Version](https://camo.githubusercontent.com/f5920d8ad1cd69e6d71eaf983fa1bb0433834caa5a0cd5fbe0f695d62261fc2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736f6d6e616d62756c6973742f6170692d636c69656e743f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/somnambulist/api-client)[![Current Version](https://camo.githubusercontent.com/25f893c83740751b48a32866b9a7478b156637c8b3b1ae5e8451d4f5e67df77e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6d6e616d62756c6973742f6170692d636c69656e743f6c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/somnambulist/api-client)

The ApiClient library is intended to help build client libraries for consuming JSON APIs. The library provides abstract models for primary resource objects and related value objects. Persistence requests are handled by ApiActions that encapsulate a change request.

Models and ValueObjects make use of [somnambulist/attribute-model](https://github.com/somnambulist-tech/attribute-model) type casting system.

The library uses Symfony HTTP Client under the hood.

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

[](#requirements)

- PHP 8.1+
- cURL
- symfony/event-dispatcher
- symfony/http-client
- symfony/routing

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

[](#installation)

Install using composer, or checkout / pull the files from github.com.

- composer require somnambulist/api-client

Usage
-----

[](#usage)

This library provides some building blocks to help you get started with consuming RESTful APIs. Typically, this is for use with a micro-services project where you need to write clients that will be shared amongst other projects.

Please note: this project does not make assumptions about the type of service being used. The included libraries provide suitable defaults, but can be completely replaced by your own implementations.

The docs are available in the docs folder with a suggested reading order as follows:

- [upgrade notes 1.X](docs/upgrading_from_1.X_to_2.0.md)
- [upgrade notes 2.X](docs/upgrading_from_2.X_to_3.0.md)
- [upgrade notes 3.X](docs/upgrading_from_3.X_to_4.0.md)
- [adding routes](docs/routing.md)
- [defining API connections](docs/connections.md)
- [expected JSON structure](docs/json_format.md)
- [using Models and ValueObjects](docs/models.md)
- [searching and querying](docs/models.md)
- [type casting attributes](docs/type_casting.md)
- [model relationships](docs/model_relationships.md)
- [storing data](docs/persistence.md)
- [recording API responses](docs/recording.md)

Tests
-----

[](#tests)

PHPUnit 9+ is used for testing. Run tests via `vendor/bin/phpunit`.

Test data was generated using faker and was randomly generated.

Links
-----

[](#links)

- [Symfony HTTP Client](https://symfony.com/doc/current/components/http_client.html)
- [Somnambulist Read-Models](https://github.com/somnambulist-tech/read-models)
- [Somnambulist Attribute-Model](https://github.com/somnambulist-tech/attribute-model)
- [Somnambulist Domain](https://github.com/somnambulist-tech/domain)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity78

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

Recently: every ~169 days

Total

40

Last Release

528d ago

Major Versions

1.8.0 → 2.0.02020-09-13

2.4.0 → 3.0.02021-01-21

3.x-dev → 4.0.02023-01-19

PHP version history (5 changes)1.0.0PHP &gt;=7.2

1.4.0PHP &gt;=7.3

2.0.0PHP &gt;=7.4

3.0.0PHP &gt;=8.0

4.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![dave-redfern](https://avatars.githubusercontent.com/u/1477147?v=4)](https://github.com/dave-redfern "dave-redfern (67 commits)")

---

Tags

apiclientphpsymfony-client

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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