Skip to content

Commit

Permalink
Readme: drop badges, added maintainer, remove old texts
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Aug 8, 2017
1 parent c29a739 commit c548f49
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

[![Build Status](https://img.shields.io/travis/contributte/api.svg?style=flat-square)](https://travis-ci.org/contributte/api)
[![Code coverage](https://img.shields.io/coveralls/contributte/api.svg?style=flat-square)](https://coveralls.io/r/contributte/api)
[![HHVM Status](https://img.shields.io/hhvm/contributte/api.svg?style=flat-square)](http://hhvm.h4cc.de/package/contributte/api)
[![Licence](https://img.shields.io/packagist/l/contributte/api.svg?style=flat-square)](https://packagist.org/packages/contributte/api)

[![Downloads this Month](https://img.shields.io/packagist/dm/contributte/api.svg?style=flat-square)](https://packagist.org/packages/contributte/api)
[![Downloads total](https://img.shields.io/packagist/dt/contributte/api.svg?style=flat-square)](https://packagist.org/packages/contributte/api)
[![Latest stable](https://img.shields.io/packagist/v/contributte/api.svg?style=flat-square)](https://packagist.org/packages/contributte/api)
[![Latest unstable](https://img.shields.io/packagist/vpre/contributte/api.svg?style=flat-square)](https://packagist.org/packages/contributte/api)

## Discussion / Help

Expand All @@ -32,26 +30,15 @@ composer require contributte/api

## Prolog

This really powerful annotation-based API library is build on top of the PSR-7 standard. It reuses immutable `Request` & `Response` objects.
It's well known that [Presenters](https://api.nette.org/2.4/Nette.Application.UI.Presenter.html) are the `alpha` and the `omega` in Nette applications.
The presenters are not very suitable for API requests.
This really powerful annotation-based API library is build on top of the PSR-7 standard. It reuses immutable `Request` & `Response` objects. It's well known that [Presenters](https://api.nette.org/2.4/Nette.Application.UI.Presenter.html) are the `alpha` and the `omega` in Nette applications. The presenters are not very suitable for API requests.

We have taken an idea from Java (Spring Framework) and many others and together we have created a Controller-based API. With full annotation support.
We have taken an idea from Java ([Spring Framework](https://spring.io/guides/gs/rest-service/)) and many others and together we have created a Controller-based API. With full annotation support.

Controllers are small objects which can be registered in DIC as services (same as [Presenters](https://api.nette.org/2.4/Nette.Application.UI.Presenter.html)).
They have a few public annotated methods. If one of the methods is matched by a router, it is called with `ApiRequest` and `ApiResponse` objects. Here comes the magic, these objects hold `PSR-7` - `Request` & `Response` instances.
Controllers are small objects which can be registered in DIC as services (same as [Presenters](https://api.nette.org/2.4/Nette.Application.UI.Presenter.html)). They have a few public annotated methods. If one of the methods is matched by a router, it is called with `ApiRequest` and `ApiResponse` passed objects.

That's all. Take a look, it's really simple.

```php
use Contributte\Api\Annotation\Controller\Controller;
use Contributte\Api\Annotation\Controller\Method;
use Contributte\Api\Annotation\Controller\Path;
use Contributte\Api\Annotation\Controller\RootPath;
use Contributte\Api\Http\Request\ApiRequest;
use Contributte\Api\Http\Response\ApiResponse;
use Contributte\Api\UI\Controller\IController;

/**
* @Controller
* @RootPath("/hello")
Expand All @@ -68,21 +55,33 @@ final class HelloController implements IController
*/
public function index(ApiRequest $request, ApiResponse $response)
{
$response->setBody('Hello world!');

return $response;
return $response->setBody('Hello world!');
}
}
```

As you can see, the architecture is ultra simple. `ApiRequest` & `ApiResponse` have no constructor, so you can easily
extend this class and implement it on your own.

## Documentation
## Overview

- [Installation - how to register an extension](https://github.com/contributte/api/tree/master/.docs#installation)
- Usage
- @todo

## Maintainers

<table>
<tbody>
<tr>
<td align="center">
<a href="https://github.com/f3l1x">
<img width="150" height="150" src="https://avatars2.githubusercontent.com/u/538058?v=3&s=150">
</a>
</br>
<a href="https://github.com/f3l1x">Milan Felix Šulc</a>
</td>
</tr>
<tbody>
</table>

-----

Expand Down

0 comments on commit c548f49

Please sign in to comment.