PHPackages                             francisdesjardins/webservice-rest-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. francisdesjardins/webservice-rest-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

francisdesjardins/webservice-rest-php
=====================================

A simple REST helper for Fat-Free-Framework

1.0.0(10y ago)2971[2 issues](https://github.com/francisdesjardins/webservice-rest-php/issues)MITPHP

Since Mar 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/francisdesjardins/webservice-rest-php)[ Packagist](https://packagist.org/packages/francisdesjardins/webservice-rest-php)[ RSS](/packages/francisdesjardins-webservice-rest-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

webservice-rest-php
===================

[](#webservice-rest-php)

A simple REST helper for Fat-Free-Framework

WIP
---

[](#wip)

Nothing much to say here ... it is a work-in-process ... you will have to figure out how to use it ... but do not worry friends, there are some examples to help you with that in [tests](https://github.com/francisdesjardins/webservice-rest-php/tree/master/tests/www).

quick and dirty example
-----------------------

[](#quick-and-dirty-example)

### index.php

[](#indexphp)

```
require_once '../../../vendor/autoload.php';

use FrancisDesjardins\WebService\Rest\Responder\Encoder\NoopResponderEncoder;
use FrancisDesjardins\WebService\Rest\Responder\ErrorResponder;
use FrancisDesjardins\WebService\Rest\Utility;

/** @var Base $fw */
$fw = Base::instance();

//! load globals
$fw->config('../app/globals.ini');

//! load globals (OS specific)
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    $fw->config('../app/globals.windows.ini');
} else {
    $fw->config('../app/globals.linux.ini');
}

//! load custom sections
$fw->config('../app/custom.ini');

//! load mappings
$fw->config('../app/maps.ini');

//! global error handler
if (!Utility::instance()->debug()) {
    $fw->set('ONERROR', function (Base $fw) {
        Utility::instance()->flushOutputBuffer();

        $responder = new ErrorResponder($fw);

        $responder->respond(new NoopResponderEncoder());
    });
}

//! run it!
$fw->run();
```

### a mapping

[](#a-mapping)

```
namespace FrancisDesjardins\WebService\Rest\Maps;

use FrancisDesjardins\WebService\Rest\AbstractRest;
use FrancisDesjardins\WebService\Rest\AuditTrait;
use FrancisDesjardins\WebService\Rest\DynamicData;
use FrancisDesjardins\WebService\Rest\ErrorEnum;
use FrancisDesjardins\WebService\Rest\Event\ErrorEvent;
use FrancisDesjardins\WebService\Rest\FatFreeFrameworkTrait;
use FrancisDesjardins\WebService\Rest\Responder\Encoder\GzipResponderEncoder;
use FrancisDesjardins\WebService\Rest\Responder\JSONResponderTrait;
use FrancisDesjardins\WebService\Rest\Security;
use FrancisDesjardins\WebService\Rest\SecurityRule\LocalhostSecurityRule;
use FrancisDesjardins\WebService\Rest\Test\Models\Result\Ok;
use FrancisDesjardins\WebService\Rest\UtilityTrait;

class Example extends AbstractRest
{
    use AuditTrait;
    use FatFreeFrameworkTrait;
    use JSONResponderTrait; // every VERB respond as application/json
    use UtilityTrait;

    // do something before routing
    public function before()
    {
        // ex: allow only localhost access
        Security::instance()->addRule(new LocalhostSecurityRule());

        // ex: audit a token
        if (!self::audit()->uuid(self::fff()->get('PARAMS.uuid'))) {
            // generate a 500 error in the headers and return {error: 5001} to the client
            self::dispatchEvent(new ErrorEvent(ErrorEnum::ERROR500(), 5001));
        }
    }

    // do something on 'GET'
    public function get() {
        // and reply
        $this->setData(new DynamicData(['property1' => 'value1']));
    }

    // do something on 'POST'
    public function post() {
        // retrieve the data; eventually it will be automatic
        $data = self::utility()->convertUnicodeToUTF8(self::fff()->get('BODY'));

        if ($data !== '') {
            // do something
        }

        // and reply
        $this->setData(new Ok());
    }

    // do something after routing
    public function after() {
        // we want every VERB to GZIP the response; can also be set per VERB
        $this->setEncoder(new GzipResponderEncoder());
    }
}
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3764d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2371ef7cdc1e6ad97c0a2f3a240a606e0c7ffe746d03c2570f5891662a52549b?d=identicon)[francisdesjardins](/maintainers/francisdesjardins)

---

Top Contributors

[![francisdesjardins](https://avatars.githubusercontent.com/u/2743830?v=4)](https://github.com/francisdesjardins "francisdesjardins (17 commits)")

---

Tags

restwebservicefat-free frameworkF3

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/francisdesjardins-webservice-rest-php/health.svg)

```
[![Health](https://phpackages.com/badges/francisdesjardins-webservice-rest-php/health.svg)](https://phpackages.com/packages/francisdesjardins-webservice-rest-php)
```

###  Alternatives

[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k853.6M8.3k](/packages/symfony-http-kernel)[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k140.4M554](/packages/zircote-swagger-php)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k66.1M254](/packages/nelmio-api-doc-bundle)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k102.4M333](/packages/pusher-pusher-php-server)[api-platform/metadata

API Resource-oriented metadata attributes and factories

244.5M182](/packages/api-platform-metadata)[shopify/shopify-api

Shopify API Library for PHP

4655.2M19](/packages/shopify-shopify-api)

PHPackages © 2026

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