PHPackages                             brunopicci/call-rest-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. brunopicci/call-rest-api

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

brunopicci/call-rest-api
========================

This bundle implements a service to call rest api

1.4.0(8y ago)02.7kMITHTMLPHP ^5.3.3 || ^7.0

Since Mar 2Pushed 8y agoCompare

[ Source](https://github.com/brunopicci/call-rest-api)[ Packagist](https://packagist.org/packages/brunopicci/call-rest-api)[ Docs](https://github.com/brunopicci/call-rest-api)[ RSS](/packages/brunopicci-call-rest-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (22)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/ec996f414fb9c6a87f91da3caa94d2b68b06349ec070d55aa12d48aa5a8db02e/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f762f737461626c65)](https://packagist.org/packages/brunopicci/call-rest-api)[![Total Downloads](https://camo.githubusercontent.com/70e562de7fbeeefd90f2c9fff8993ea771ae4729522a62e10feb8cfb2abb66c3/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f646f776e6c6f616473)](https://packagist.org/packages/brunopicci/call-rest-api)[![Latest Unstable Version](https://camo.githubusercontent.com/71ffff21fd5a851957c99e2678317ff57bafd8319e3e77089df92a8d9829565b/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f762f756e737461626c65)](https://packagist.org/packages/brunopicci/call-rest-api)[![License](https://camo.githubusercontent.com/0b6c6ceee81ce7a09979a9f1510e4591396e229553ccf1048deedc9302158e9b/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f6c6963656e7365)](https://packagist.org/packages/brunopicci/call-rest-api)[![Monthly Downloads](https://camo.githubusercontent.com/892b10c2220e0a65d607a25fd1a8853b87edcf12c601e6e5f379949354dfd8c5/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f642f6d6f6e74686c79)](https://packagist.org/packages/brunopicci/call-rest-api)[![Daily Downloads](https://camo.githubusercontent.com/7d739e6a1a04e0934391296b5123156a08bdb7c67d748cd6553bfc1197b18ab1/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f642f6461696c79)](https://packagist.org/packages/brunopicci/call-rest-api)[![composer.lock](https://camo.githubusercontent.com/ab390ac32734b0b5bddc7d858ff73319f238c50327d8423cca16ce0e23b24c59/68747470733a2f2f706f7365722e707567782e6f72672f6272756e6f70696363692f63616c6c2d726573742d6170692f636f6d706f7365726c6f636b)](https://packagist.org/packages/brunopicci/call-rest-api)

ServicesBundle
==============

[](#servicesbundle)

This bundle implements a service to call rest api. Features include:

- Call a rest API and receive a json decoded to array
- Call a rest API and receive a json not decoded
- Automatically you can pass as parameter the http verb and json, it automatically will make the request

Note
----

[](#note)

The bundle is released and can be used. However it under heavy development.

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

[](#documentation)

This bundle permit to call rest api and offer an entity with base configuration to return a json.

To use this bundle, first you must use the service with DI like this:

```
$apiRest = $this->get('services.chiamatarest');
```

Then you can do your settings to the service. By default the service will search, in the json response from rest api, for a field named "message" that contain the result message of the call and for a field name "success" for the result (true or false) of the call. If this doesn't meet you, you can change thei name in this way:

For the message field:

```
$apiRest->setNomeCampoMessage("");
```

For the success field:

```
$apiRest->setNomeCampoSuccess("");
```

You can also decide to not make the test for a specific field setting this option:

```
$apiRest->setControlSuccess(false);
```

By default it's true.

Then, you can make other settings, like this for example:

Setting the project that is calling, for the logs:

```
$apiRest->setChiamante("");
```

Set your http verb

```
$apiRest->setTipoChiamata("
