Skip to content

Instantly share code, notes, and snippets.

@guilhermewop
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilhermewop/821b47f31a327047d137 to your computer and use it in GitHub Desktop.
Save guilhermewop/821b47f31a327047d137 to your computer and use it in GitHub Desktop.
Apigility client usage
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction()
{
// $client = $this->getServiceLocator()->get('ApigilityClient\Http\Client');
// or
$client = $this->getServiceLocator()->get('apigility.client');
//$response = $client->post('path/to/service', ['param' => 'value']);
$response = $client->get('path/to/service', ['param' => 'value']);
return new ViewModel([
'data' => $response
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment