PHPackages                             rafrsr/generic-api - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. rafrsr/generic-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

rafrsr/generic-api
==================

API Abstraction layer with mocks

v3.0.1(4mo ago)39.3k↓50%12MITPHPPHP &gt;=8.1

Since Jan 4Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/rafrsr/generic-api)[ Packagist](https://packagist.org/packages/rafrsr/generic-api)[ Docs](http://rafrsr.github.io/generic-api/)[ RSS](/packages/rafrsr-generic-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (26)Used By (2)

Generic API
===========

[](#generic-api)

[![Build Status](https://camo.githubusercontent.com/99cb90bfda9dfbe3fe9ff89a65f04076742d635a2574f020f586a931bcbb21fc/68747470733a2f2f7472617669732d63692e6f72672f7261667273722f67656e657269632d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rafrsr/generic-api)[![Coverage Status](https://camo.githubusercontent.com/f1cda99e12ee0b6337a36021ca8317729926632f4c118ebd1195f5c0bb7a571e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7261667273722f67656e657269632d6170692f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/rafrsr/generic-api?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/11e502a7d999949b0c2c62a2c958d1357287c9aa76bd2d57b6a68fddb93b3d47/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f67656e657269632d6170692f76657273696f6e)](https://packagist.org/packages/rafrsr/generic-api)[![Latest Unstable Version](https://camo.githubusercontent.com/079165fc1e07318b5c6aa3e0110d8437ce76654a9dc588f71e5f2b77cbce9b95/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f67656e657269632d6170692f762f756e737461626c65)](//packagist.org/packages/rafrsr/generic-api)[![Total Downloads](https://camo.githubusercontent.com/57585c977776243fa9a62f68df0c8ced5c51718a02b8f6b2b695c3e5f78c9572/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f67656e657269632d6170692f646f776e6c6f616473)](https://packagist.org/packages/rafrsr/generic-api)[![License](https://camo.githubusercontent.com/9fdd182123d4ff675d566f209086f0588b6a89217d91542ced37c67c3ffccc98/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f67656e657269632d6170692f6c6963656e7365)](https://packagist.org/packages/rafrsr/generic-api)

API Abstraction layer with mocks. Tools for creating structured SDKs or API implementations easy and following some simple guidelines.

Most APIs provide a SDK or API implementation library in parallel. But this not always true, or simply not made in our required language (php). For this cases is necessary implements the API from scratch. GenericApi is solution to keep things organized and follow a similar pattern for all libraries.

Features
--------

[](#features)

- **Guzzle:** Use guzzle with psr7 for requests, responses, and streams.
- **Mocks:** Emulate request and response for test environments
- **Validation:** Symfony validations to validate a request before send any data to remote API
- **Connection Abstraction:** Only create the request, the connection is done automatically with guzzle, no more complicated curl connections.
- **Xml and Json Parser:** Can use XML and JSON parser to convert API response to objects using JMS serializer
- **Scaffolding:** Test API connection and any method using generic classes

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

[](#installation)

1. [Install composer](https://getcomposer.org/download/)
2. Execute: `composer require rafrsr/generic-api`

Documentation
-------------

[](#documentation)

Full documentation are available on the [wiki page](https://github.com/rafrsr/generic-api/wiki)

Functional Example
------------------

[](#functional-example)

Can view a more complex example of functional API in the "sample" folder.

Copyright
---------

[](#copyright)

This project is licensed under the [MIT license](LICENSE).

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance78

Regular maintenance activity

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 89.2% 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 ~152 days

Recently: every ~449 days

Total

25

Last Release

122d ago

Major Versions

v1.0.0 → v2.0.02016-02-02

v2.1.3 → v3.0-beta12021-12-08

PHP version history (4 changes)v1.0.0PHP &gt;=5.5

v2.1.0PHP &gt;=7.2.5

v3.0-beta1PHP &gt;=8.0.2

v3.0.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a2b6fe4cdd0f7970b78769f972884c46759925b8bfe9814e47a2799b6439de7?d=identicon)[rafrsr](/maintainers/rafrsr)

---

Top Contributors

[![rafrsr](https://avatars.githubusercontent.com/u/7094012?v=4)](https://github.com/rafrsr "rafrsr (83 commits)")[![yceruto](https://avatars.githubusercontent.com/u/2028198?v=4)](https://github.com/yceruto "yceruto (9 commits)")[![diadal](https://avatars.githubusercontent.com/u/19895516?v=4)](https://github.com/diadal "diadal (1 commits)")

---

Tags

apisdkGuzzle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rafrsr-generic-api/health.svg)

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

###  Alternatives

[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)[infobip/infobip-api-php-client

PHP library for consuming Infobip's API

921.8M10](/packages/infobip-infobip-api-php-client)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[api-platform/serializer

API Platform core Serializer

223.4M31](/packages/api-platform-serializer)

PHPackages © 2026

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