PHPackages                             franjid/api-wrapper-bundle - 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. franjid/api-wrapper-bundle

ActiveSymfony-bundle[API Development](/categories/api)

franjid/api-wrapper-bundle
==========================

API Wrapper Bundle. Consume API's from Symfony

v1.0.0(9y ago)6691MITPHPPHP ^5.5.9|~7.0

Since Jan 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/franjid/api-wrapper-bundle)[ Packagist](https://packagist.org/packages/franjid/api-wrapper-bundle)[ RSS](/packages/franjid-api-wrapper-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

API Wrapper Bundle for Symfony
==============================

[](#api-wrapper-bundle-for-symfony)

[![Build Status](https://camo.githubusercontent.com/5b470ebcf0ac9ffaa67c839147caaf1d3afe0ccca3a57e66c52850aad6b820c0/68747470733a2f2f7472617669732d63692e6f72672f6672616e6a69642f6170692d777261707065722d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/franjid/api-wrapper-bundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/318487920240b554a9662e895b42b5c82bb87ff38ea453292189ab9045f73ebd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6672616e6a69642f6170692d777261707065722d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/franjid/api-wrapper-bundle/)[![Code Coverage](https://camo.githubusercontent.com/cb66e97136515f7aa9c01cf18bedd2a930016cd0977b1e70662c861e5fd82dc1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6672616e6a69642f6170692d777261707065722d62756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/franjid/api-wrapper-bundle/)

The aim of this bundle is to act as a wrapper for any API library you want to use in Symfony. In this case with Guzzle, the most popular PHP HTTP client library.

It has never been so easy to consume an API than with this bundle.

What can you find?
------------------

[](#what-can-you-find)

##### Api.php

[](#apiphp)

This is where the encapsulation magic happens.

It has only one method **send** that sends the proper request to the API.

##### ApiClientFactory.php

[](#apiclientfactoryphp)

Used to create all different API clients. When defined it requires a base uri for the API as a simple string or an array of different url's. In case that an array is given, the factory will choose one of them randomly. This is kind of a basic basic load balancer implemented because of reasons.

##### ApiRequest.php

[](#apirequestphp)

It has to be used to send requests to API's. Using the different methods you will be able to set the request method (GET, POST, etc), set headers, set the endpoint, etc.

##### ApiResponse.php

[](#apiresponsephp)

Object returned when successfully calling **send** method in *Api*. You can get the response status code, headers or body.

How to use it
-------------

[](#how-to-use-it)

First things first, install package via composer:

```
composer require franjid/api-wrapper-bundle

```

And add the bundle to your AppKernel.php

```
new \Franjid\ApiWrapperBundle\ApiWrapperBundle(),

```

### Example: adding an API for [Xkcd API](https://xkcd.com/json.html)

[](#example-adding-an-api-for-xkcd-api)

You can check a project with example code using the bundle in [this repository](https://github.com/franjid/api-wrapper-bundle-example)

First step is to define the API Client in your services config file

```
    ApiClientXkcd:
        class: ApiClientXkcd
        factory: [@ApiWrapperBundle.Component.Api.ApiClientFactory, createApiClient]
        arguments:
            - %apiXkcdBaseURI%

```

That will create the *ApiClientXkcd* taking the parameter *apiXkcdBaseURI* and injecting it so we have a base URI.

apiXkcdBaseURI should be in the format

```
    apiXkcdBaseURI: 'http://xkcd.com/'

```

Now is time to create the interface, then the service class and add it to your services config file

```
    Service.Api.ApiXkcdServiceInterface:
        class: AppBundle\Service\Api\ApiXkcdService
        arguments:
            - @ApiClientXkcd

```

At this moment you're ready to go for adding your awesome methods that will call the API.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3411d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f42e250c2774879e72668ea0d2d76ec72d158141adf5562fe9f8afad92ddc29?d=identicon)[franjid](/maintainers/franjid)

---

Top Contributors

[![franjid](https://avatars.githubusercontent.com/u/3618928?v=4)](https://github.com/franjid "franjid (16 commits)")

---

Tags

apiapi-wrapperbundlephpsymfonywrapperphpapisymfonybundlewrapper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/franjid-api-wrapper-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/franjid-api-wrapper-bundle/health.svg)](https://phpackages.com/packages/franjid-api-wrapper-bundle)
```

###  Alternatives

[harmbandstra/swagger-ui-bundle

Exposes swagger UI inside your Symfony project through a route (eg. /docs)

42867.3k](/packages/harmbandstra-swagger-ui-bundle)[php-tmdb/symfony

Symfony Bundle for TMDB (The Movie Database) API. Provides easy access to the php-tmdb/api library.

3649.7k](/packages/php-tmdb-symfony)[artyuum/request-dto-mapper-bundle

This bundle provides an easy way to automatically map the incoming request data to a DTO and optionally validate it.

515.8k](/packages/artyuum-request-dto-mapper-bundle)[stfalcon-studio/api-bundle

Base classes and helper services to build API application via Symfony.

1032.1k](/packages/stfalcon-studio-api-bundle)[maxbeckers/amazon-alexa-bundle

Symfony Bundle for amazon alexa skills.

132.1k](/packages/maxbeckers-amazon-alexa-bundle)

PHPackages © 2026

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