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

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

leaseweb/api-caller-bundle
==========================

cURL API call functionality with full Web Debug Toolbar integration

v1.2.12(5y ago)64417.4k↓38.9%34[5 issues](https://github.com/LeaseWeb/LswApiCallerBundle/issues)[1 PRs](https://github.com/LeaseWeb/LswApiCallerBundle/pulls)1MITPHPPHP ^7.1

Since Apr 8Pushed 3y ago19 watchersCompare

[ Source](https://github.com/LeaseWeb/LswApiCallerBundle)[ Packagist](https://packagist.org/packages/leaseweb/api-caller-bundle)[ Docs](http://www.leaseweblabs.com)[ RSS](/packages/leaseweb-api-caller-bundle/feed)WikiDiscussions master Synced 1mo ago

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

LswApiCallerBundle
==================

[](#lswapicallerbundle)

[![screenshot](https://camo.githubusercontent.com/c6f0d7b7e8c2cf2c03426b29d5a71f4b6d95075a20fe584b9a7f724c8587cc1a/687474703a2f2f7777772e6c656173657765626c6162732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031332f30312f6170695f63616c6c65722e706e67)](https://camo.githubusercontent.com/c6f0d7b7e8c2cf2c03426b29d5a71f4b6d95075a20fe584b9a7f724c8587cc1a/687474703a2f2f7777772e6c656173657765626c6162732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031332f30312f6170695f63616c6c65722e706e67)

The LswApiCallerBundle adds a CURL API caller to your Symfony2 application. It is easy to use from the code and is aimed to have full debugging capabilities.

[Read the LeaseWebLabs blog about LswApiCallerBundle](http://www.leaseweblabs.com/2013/01/symfony2-bundle-for-curl-api-calling/)

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

[](#requirements)

- PHP 5.3 with curl support
- Symfony &gt;= 2.1

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

[](#installation)

Installation is broken down in the following steps:

1. Download LswApiCallerBundle using composer
2. Enable the Bundle
3. Make sure the cURL module in PHP is enabled

### Step 1: Download LswApiCallerBundle using composer

[](#step-1-download-lswapicallerbundle-using-composer)

Add LswApiCallerBundle in your composer.json:

```
{
    "require": {
        "leaseweb/api-caller-bundle": "*",
        ...
    }
}
```

Now tell composer to download the bundle by running the command:

```
$ php composer.phar update leaseweb/api-caller-bundle
```

Composer will install the bundle to your project's `vendor/leaseweb` directory.

### Step 2: Enable the bundle

[](#step-2-enable-the-bundle)

Enable the bundle in the kernel:

```

```

It should display that the option "cURL support" is set to "enabled".

This package should work on a Windows installation as well provided the CURL support is enabled in PHP.

Usage
-----

[](#usage)

You can use the caller by getting the service "api\_caller" and using the "call" function with one of the available call types:

- HttpGetJson
- HttpPostJson
- HttpPostJsonBody (the body will be json\_encode)
- HttpPutJson
- HttpDeleteJson
- HttpGetHtml

Example of usage with the "HttpGetJson" call type:

```
use Symfony\Bundle\FrameworkBundle\Controller\Controller
use Lsw\ApiCallerBundle\Call\HttpGetJson;

class SomeController extends Controller
{
    public function someAction()
    {
        ...
        $output = $this->get('api_caller')->call(new HttpGetJson($url, $parameters));
        ...
    }
}
```

Example of usage with the "HttpPostJsonBody" call type:

```
use Symfony\Bundle\FrameworkBundle\Controller\Controller
use Lsw\ApiCallerBundle\Call\HttpPostJsonBody;

class SomeController extends Controller
{
    public function someAction()
    {
        ...
        $arrayToPost = array(
            'ip_address' => array(
                'name' => 'IpName',
                'hostname' => 'HostName',
                'ip' => '192.168.0.1',
                'throttling_template' => array(
                    'name' => 'Throttling Template'
                )
            )
        ); // this will be json_encode. If you don't want to json_encode, use HttpPostJson instead of HttpPostJsonBody
        $output = $this->get('api_caller')->call(new HttpPostJsonBody($url, $arrayToPost, true, $parameters)); // true to have an associative array as answer
        ...
    }
}
```

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

[](#configuration)

By default it uses these cURL options:

```
parameters:
    api_caller.options:
        timeout: 10  # maximum transport + execution duration of the call in sec.
        ssl_verifypeer: false  # to stop cURL from verifying the peer's certificate.
        useragent: "LeaseWeb API Caller"  # contents of the "User-Agent: " header.
        followlocation: true  # to follow any "Location: " header that the server sends.
        sslversion: 3  # set to 3 to avoid any bugs that relate to automatic version selection.
        fresh_connect: false  # set to true to force full reconnect every call.
```

License
-------

[](#license)

This bundle is under the MIT license.

The "wall-socket" icon in the web debug toolbar is part of the Picas icon set (official website: ). The icon is licensed and may only be used to identifying the LswApiCallerBundle in the Symfony2 web debug toolbar. All ownership and copyright of this icon remain the property of Rok Benedik.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~288 days

Total

24

Last Release

2036d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.2

v1.2.12PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/07471fe4d781492d9c6dfee2259d66b399737cc634b6048c043f3cb3dfaa1cc8?d=identicon)[LeaseWeb](/maintainers/LeaseWeb)

---

Top Contributors

[![mevdschee](https://avatars.githubusercontent.com/u/1288217?v=4)](https://github.com/mevdschee "mevdschee (11 commits)")[![GabrielAnca](https://avatars.githubusercontent.com/u/251391?v=4)](https://github.com/GabrielAnca "GabrielAnca (6 commits)")[![comstar](https://avatars.githubusercontent.com/u/787876?v=4)](https://github.com/comstar "comstar (6 commits)")[![RolphH](https://avatars.githubusercontent.com/u/10166243?v=4)](https://github.com/RolphH "RolphH (5 commits)")[![Minras](https://avatars.githubusercontent.com/u/1045750?v=4)](https://github.com/Minras "Minras (2 commits)")[![pguso](https://avatars.githubusercontent.com/u/4007140?v=4)](https://github.com/pguso "pguso (2 commits)")[![jpillias](https://avatars.githubusercontent.com/u/17312979?v=4)](https://github.com/jpillias "jpillias (1 commits)")[![marcobuschini](https://avatars.githubusercontent.com/u/6851947?v=4)](https://github.com/marcobuschini "marcobuschini (1 commits)")[![nbas11](https://avatars.githubusercontent.com/u/454696?v=4)](https://github.com/nbas11 "nbas11 (1 commits)")[![qtsd](https://avatars.githubusercontent.com/u/10633476?v=4)](https://github.com/qtsd "qtsd (1 commits)")[![SebastianStorz](https://avatars.githubusercontent.com/u/56382656?v=4)](https://github.com/SebastianStorz "SebastianStorz (1 commits)")[![spoelwijk](https://avatars.githubusercontent.com/u/81775?v=4)](https://github.com/spoelwijk "spoelwijk (1 commits)")[![TNAJanssen](https://avatars.githubusercontent.com/u/2812277?v=4)](https://github.com/TNAJanssen "TNAJanssen (1 commits)")[![camille-hdl](https://avatars.githubusercontent.com/u/516907?v=4)](https://github.com/camille-hdl "camille-hdl (1 commits)")[![zakharovvi](https://avatars.githubusercontent.com/u/1424281?v=4)](https://github.com/zakharovvi "zakharovvi (1 commits)")[![cbougher](https://avatars.githubusercontent.com/u/271148?v=4)](https://github.com/cbougher "cbougher (1 commits)")[![dtdigio](https://avatars.githubusercontent.com/u/26926463?v=4)](https://github.com/dtdigio "dtdigio (1 commits)")[![fancyweb](https://avatars.githubusercontent.com/u/3658119?v=4)](https://github.com/fancyweb "fancyweb (1 commits)")[![iisisrael](https://avatars.githubusercontent.com/u/932987?v=4)](https://github.com/iisisrael "iisisrael (1 commits)")[![istaveren](https://avatars.githubusercontent.com/u/205372?v=4)](https://github.com/istaveren "istaveren (1 commits)")

---

Tags

apicurlSymfony2

### Embed Badge

![Health badge](/badges/leaseweb-api-caller-bundle/health.svg)

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

###  Alternatives

[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.2M267](/packages/nategood-httpful)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69114.3k](/packages/serpapi-google-search-results-php)[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

11259.2k](/packages/e-moe-guzzle6-bundle)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)

PHPackages © 2026

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