2017 © Pedro Peláez
 

library retrofit-php

a fork of tebru/retrofit-php

image

molchanoviv/retrofit-php

a fork of tebru/retrofit-php

  • Monday, September 12, 2016
  • by molchanoviv
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2,264 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 19 Forks
  • 0 Open issues
  • 48 Versions
  • 0 % Grown

The README.md

Retrofit PHP

Build Status Coverage Status Scrutinizer Code Quality SensioLabsInsight, (*1)

This library aims to ease creation of REST clients. It is blatantly stolen from square/retrofit and implemented in PHP., (*2)

Overview

Retrofit allows you to define your REST API with a simple interface., (*3)

<?php

use Tebru\Retrofit\Annotation as Rest;

interface GitHubService
{
    /**
     * @Rest\GET("/users/{user}/list")
     * @Rest\Returns("ArrayCollection<ListRepo>")
     */
    public function listRepos($user);
}

Annotations are used to configure the endpoint. Then, the RestAdapter class generates a working implementation of the service interface., (*4)

<?php

use Tebru\Retrofit\Adapter\RestAdapter;

$restAdapter = RestAdapter::builder()
    ->setBaseUrl('https://api.github.com')
    ->build();

$gitHubService = $restAdapter->create(GitHubService::class);

Our newly created service is capable of making GET requests to /users/$user/list to return an ArrayCollection of ListRepo objects., (*5)

$repos = $gitHubService->listRepos('octocat');

Usage examples are referenced from Square's documentation, (*6)

Installation & Usage

composer require tebru/retrofit-php

Please make sure you also install an http client. Currently guzzle is the only supported option, (*7)

composer require guzzlehttp/guzzle

Documentation

License

This project is licensed under the MIT license. Please see the LICENSE file for more information., (*8)

The Versions

18/08 2015
18/08 2015
18/08 2015
18/08 2015

v2.0.0

2.0.0.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette

01/04 2015

v0.2.1

0.2.1.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette

31/03 2015

v0.2.0

0.2.0.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette

30/03 2015

v0.1.3

0.1.3.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette

18/03 2015

v0.1.2

0.1.2.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette

11/03 2015

v0.1.1

0.1.1.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette

06/02 2015

v0.1.0

0.1.0.0

Retrofit for PHP - A PHP REST client.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nate Brunette