PHPackages                             lokhman/silex-restful - 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. [API Development](/categories/api)
4. /
5. lokhman/silex-restful

ActiveLibrary[API Development](/categories/api)

lokhman/silex-restful
=====================

Silex 2.0+ service provider for RESTful middleware

2.0.2(9y ago)0375MITPHP

Since Jan 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/lokhman/silex-restful)[ Packagist](https://packagist.org/packages/lokhman/silex-restful)[ RSS](/packages/lokhman-silex-restful/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

silex-restful
=============

[](#silex-restful)

[![StyleCI](https://camo.githubusercontent.com/9534bc84da419935647bc477f06436902daf4e89b041fe89885c8e0b599fee62/68747470733a2f2f7374796c6563692e696f2f7265706f732f37393930373130392f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/79907109)

RESTful middleware service provider for [**Silex 2.0+**](http://silex.sensiolabs.org/) micro-framework.

> This project is a part of [`silex-tools`](https://github.com/lokhman/silex-tools) library.

Installation
----------------------------------------------------

[](#installation)

You can install `silex-restful` with [Composer](http://getcomposer.org):

```
composer require lokhman/silex-restful

```

Documentation
------------------------------------------------------

[](#documentation)

Registering `RestfulServiceProvider` will easily extend your application routing with JSON request/response methods, error handing and JSON parameter acceptance. It works in the same way as Silex routing binding (`get`, `post`, etc), supports own `controllers_factory` and `mount` functionality.

```
use Lokhman\Silex\Provider\RestfulServiceProvider;

$app->register(new RestfulServiceProvider());

// response is transformed to JSON string
$app['restful']->get('/api', function() {
    return ['version' => '1.0'];
});

// can mount controller collections
$app['restful']->mount('/api/v2', function($api) {
    // accepts parameters from "application/json" body
    $api->post('/submit', function(Request $request) {
        return ['params' => $request->request->all()];
    });
});

// can mount controller providers
class ApiBundle implements ControllerProviderInterface {

    function connect(Application $app) {
        $factory = $app['restful.controllers_factory'];

        $factory->get('/', function() {
            // will modify all exceptions to JSON compatible responses
            throw new GoneHttpException('API v3 is not supported anymore.');
        });

        return $factory->getControllerCollection();
    }

}

$app->mount('/api/v3', new ApiBundle());

```

License
------------------------------------------

[](#license)

Library is available under the MIT license. The included LICENSE file describes this in detail.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~42 days

Total

3

Last Release

3359d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17a4b2bb3c64905c2663115cb0a3ef36854123b51709645576a591fb72fbef10?d=identicon)[lokhman](/maintainers/lokhman)

---

Top Contributors

[![lokhman](https://avatars.githubusercontent.com/u/7714105?v=4)](https://github.com/lokhman "lokhman (7 commits)")

---

Tags

restfulsilextoolstoolssilexrestful

### Embed Badge

![Health badge](/badges/lokhman-silex-restful/health.svg)

```
[![Health](https://phpackages.com/badges/lokhman-silex-restful/health.svg)](https://phpackages.com/packages/lokhman-silex-restful)
```

###  Alternatives

[api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

3161.6M10](/packages/api-ecosystem-for-laravel-dingo-api)[essa/api-tool-kit

set of tools to build an api with laravel

53386.5k](/packages/essa-api-tool-kit)[light/yii2-swagger

swagger intergation with yii2

153835.2k4](/packages/light-yii2-swagger)[slince/shopify-api-php

Shopify API Client for PHP

132244.5k1](/packages/slince-shopify-api-php)[phpexperts/simple-dto

A quick and easy DTO package.

501.1M7](/packages/phpexperts-simple-dto)[nezamy/route

Route - Fast, flexible routing for PHP, enabling you to quickly and easily build RESTful web applications.

21437.8k5](/packages/nezamy-route)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
