Skip to content

Instantly share code, notes, and snippets.

@koriym
Last active August 29, 2015 14:11
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 koriym/6cdb82fe5ebf8fe219bd to your computer and use it in GitHub Desktop.
Save koriym/6cdb82fe5ebf8fe219bd to your computer and use it in GitHub Desktop.
Syntax suger of get request
/**
* @param string|Uri $uri
* @param array $query
*
* @return callable
*/
function resource($uri, array $query)
{
$resource = (new Injector(new AppModule, __DIR__ . '/tmp'))->getInstance(ResourceInterface::class);
$request = $resource->get->uri($uri)->withQuery($query)->eager->request();
return $request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment