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

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

icedevelop/call-rest-api
========================

This bundle implements a service to call rest api

1.2.4(5y ago)011MITHTMLPHP ^5.3.3 || ^7.0

Since May 26Pushed 2y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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("
