PHPackages                             kilylabs/phprest - 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. [Framework](/categories/framework)
4. /
5. kilylabs/phprest

ActiveLibrary[Framework](/categories/framework)

kilylabs/phprest
================

PHP Rest Framework.

0.2.5(5y ago)1605MITPHPPHP ^7.2

Since Sep 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kilylabs/phprest)[ Packagist](https://packagist.org/packages/kilylabs/phprest)[ RSS](/packages/kilylabs-phprest/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (12)Versions (8)Used By (0)

Kily Labs
=========

[](#kily-labs)

Added PHP 7.0 support!

Phprest
=======

[](#phprest)

[![Build Status](https://camo.githubusercontent.com/f33c099784058b1c4fcdc0e0076903a0e3942a016234879c77c5ece1118d4ad8/68747470733a2f2f7472617669732d63692e636f6d2f6179616e6f7a7475726b2f706870726573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/ayanozturk/phprest)[![Code Coverage](https://camo.githubusercontent.com/ae33ef0f14c227293bb089b4aeee52073e62d3c94c2ec035ca1c8bfe9b5e1c5b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6179616e6f7a7475726b2f706870726573742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ayanozturk/phprest/?branch=master)[![Quality Score](https://camo.githubusercontent.com/ea15a96d4ebdbc974c2495ab2aca23765f59ebf8a8c9b4c650418ebd1b6cc1c8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6179616e6f7a7475726b2f706870726573742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ayanozturk/phprest/?branch=master)[![Software License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Description
===========

[](#description)

REST-like PHP micro-framework.

It's based on the [Proton](https://github.com/alexbilbie/Proton) ([StackPhp](http://stackphp.com/) compatible) micro-framework.

Phprest gives you only the very basics to build your own architecture within your own framework and assemble any folder structure you like. It is just a thin layer around your application with the help of some great libraries.

Components
==========

[](#components)

- [League\\Container](https://github.com/thephpleague/container)
- [League\\Route](https://github.com/thephpleague/route)
- [League\\Event](https://github.com/thephpleague/event)
- [League\\BooBoo](https://github.com/thephpleague/booboo)
- [Willdurand\\Negotiation](https://github.com/willdurand/Negotiation)
- [Willdurand\\Hateoas](https://github.com/willdurand/Hateoas)
- [Monolog\\Monolog](https://github.com/Seldaek/monolog)
- [Stack\\Builder](https://github.com/stackphp/builder)

Skills
======

[](#skills)

- Dependency injection
- Routing
- Error handling
- Serialization
- Deserialization
- HATEOAS
- API versioning
- Pagination
- Logging

ToC
===

[](#toc)

- [Installation](https://github.com/phprest/phprest#installation)
- [Usage](https://github.com/phprest/phprest#usage)
    - [Services](https://github.com/phprest/phprest#services)
    - [Setup](https://github.com/phprest/phprest#setup)
        - [Configuration](https://github.com/phprest/phprest#configuration)
        - [Logging](https://github.com/phprest/phprest#logging)
        - [Usage with Stack](https://github.com/phprest/phprest#usage-with-stack)
    - [API versioning](https://github.com/phprest/phprest#api-versioning)
    - [Routing](https://github.com/phprest/phprest#routing)
        - [Simple routing](https://github.com/phprest/phprest#simple-routing)
        - [Routing with arguments](https://github.com/phprest/phprest#routing-with-arguments)
        - [Routing through a controller](https://github.com/phprest/phprest#routing-through-a-controller)
        - [Routing through a service controller](https://github.com/phprest/phprest#routing-through-a-service-controller)
        - [Routing with annotations](https://github.com/phprest/phprest#routing-with-annotations)
    - [Controller](https://github.com/phprest/phprest#controller)
    - [Serialization, Deserialization, HATEOAS](https://github.com/phprest/phprest#serialization-deserialization-hateoas)
        - [Serialization example](https://github.com/phprest/phprest#serialization-example)
        - [Deserialization example](https://github.com/phprest/phprest#deserialization-example)
    - [Pagination](https://github.com/phprest/phprest#pagination)
    - [Responses](https://github.com/phprest/phprest#responses)
        - [1xx, 2xx, 3xx status codes](https://github.com/phprest/phprest#1xx-2xx-3xx-status-codes)
            - [Example](https://github.com/phprest/phprest#example)
            - [Types](https://github.com/phprest/phprest#types)
        - [4xx, 5xx status codes](https://github.com/phprest/phprest#4xx-5xx-status-codes)
            - [Example](https://github.com/phprest/phprest#example-1)
            - [Types](https://github.com/phprest/phprest#types-1)
    - [Dependency Injection Container](https://github.com/phprest/phprest#dependency-injection-container)
    - [CLI](https://github.com/phprest/phprest#cli)
- [Error handler](https://github.com/phprest/phprest#error-handler)
    - [On a single exception](https://github.com/phprest/phprest#on-a-single-exception)
- [Authentication](https://github.com/phprest/phprest#authentication)
    - [Basic Authentication](https://github.com/phprest/phprest#basic-authentication)
    - [JWT Authentication](https://github.com/phprest/phprest#jwt-authentication)
- [API testing](https://github.com/phprest/phprest#api-testing)
- [API documentation](https://github.com/phprest/phprest#api-documentation)

Installation
============

[](#installation)

Install it through composer.

```
{
    "require": {
        "phprest/phprest": "@stable"
    }
}
```

**tip:** you should browse the [`phprest/phprest`](https://packagist.org/packages/phprest/phprest)page to choose a stable version to use, avoid the `@stable` meta constraint.

Usage
=====

[](#usage)

Services
--------

[](#services)

There are a couple of services which can help you to solve some general problems:

- [Validator](https://github.com/phprest/phprest-service-validator)
- [Request Filter](https://github.com/phprest/phprest-service-request-filter)
- [Orm](https://github.com/phprest/phprest-service-orm)

*These are separate repositories.*

Setup
-----

[](#setup)

```
