PHPackages                             bulton-fr/bfw-api - 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. bulton-fr/bfw-api

ActiveLibrary[API Development](/categories/api)

bulton-fr/bfw-api
=================

API module for BFW

1.0.2(11y ago)1305[1 issues](https://github.com/bfw-systems/api/issues)LGPL-3.0PHPPHP &gt;=5.3.0

Since May 10Pushed 6y ago3 watchersCompare

[ Source](https://github.com/bfw-systems/api)[ Packagist](https://packagist.org/packages/bulton-fr/bfw-api)[ Docs](https://github.com/bulton-fr/bfw-api)[ RSS](/packages/bulton-fr-bfw-api/feed)WikiDiscussions 2.0 Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (17)Used By (0)

bfw-api
=======

[](#bfw-api)

[![Build Status](https://camo.githubusercontent.com/40f91b02e938920ee8519555bc1a2f382eeb5b927e6f400b713f1887117508bf/68747470733a2f2f7472617669732d63692e6f72672f62756c746f6e2d66722f6266772d6170692e7376673f6272616e63683d322e30)](https://travis-ci.org/bulton-fr/bfw-api) [![Coverage Status](https://camo.githubusercontent.com/c22c6715a58b6f80b9ab4f399ad2435793cdbe98c3441750c940183a52f38ba3/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f62756c746f6e2d66722f6266772d6170692f62616467652e7376673f6272616e63683d322e30)](https://coveralls.io/github/bulton-fr/bfw-api?branch=2.0) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/28fc8b111e22855bc5e6bb1e0f8e7a662f636b93de7a4e40a2f92417bd9a9842/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62756c746f6e2d66722f6266772d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d322e30)](https://scrutinizer-ci.com/g/bulton-fr/bfw-api/?branch=2.0)[![Latest Stable Version](https://camo.githubusercontent.com/d5346aa410704ee933c7d1a0459547e450957671c162cdeae1c248c0e337c84c/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f6266772d6170692f762f737461626c65)](https://packagist.org/packages/bulton-fr/bfw-api) [![License](https://camo.githubusercontent.com/6c1be76419dae624c21a3b6df9affaed99e109d13bf6916cfd3b525f5f3f2bbd/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f6266772d6170692f6c6963656e7365)](https://packagist.org/packages/bulton-fr/bfw-api)

Module to use an API with the BFW framework

---

**Install :**

You can use composer to get the module : `composer require bulton-fr/bfw-api @stable`

And to install the module : `./vendor/bin/bfwInstallModules`

**Config :**

All config file for this module will be into `app/config/bfw-api/`. There are two files to configure (manifest.json is for the module update system).

First, the file config.php

- `urlPrefix` : The prefix of all url used by the api.
- `useRest` : If the API will use the REST format
- `useGraphQL` : If the API will use the GraphQL format. But you can't use it for the moment, it's not implemented yet ! (issue [\#2](https://github.com/bulton-fr/bfw-api/issues/2))

Next, the file routes.php

It's all routes of your api. The prefix write into the other config file should not be added into the route url. To know the route format to use, please refer you to the exemple write into the routes.php config file.

Note : If not method is present, the route will respond to all http methods (get, set, put and delete).

**Use it :**

I will only explain to REST API because the GraphQL API is not implemented yet. I will update this section when it will implemented.

You will create you API class controllers into the directory /src/api/. All classes should extends the class \\BfwApi\\Rest class.

You will add a method for each used HTTP method for you controller. All datas receive from the request will be present into the property `$datas`. Il you want return an response, you can use the method `sendResponsesendResponse(&$response)`. This method will automaticaly detect the response format to use (xml or json) from the HTTP request and convert your response to the correct format before sent it.

**Example :**

Configs :

```
return [
    'urlPrefix' => '/api',
    'useRest' => true,
    'useGraphQL' => false
];
```

```
return [
    'routes' => [
       '/books/{bookId:\d+}' => [
            'className' => 'Book',
            'method'    => ['GET', 'POST']
        ],
    ]
];
```

Controller class :

```
namespace Api;

class Book extends \BfwApi\Rest
{
    public function getRequest()
    {
        $returnedDatas = (object) [
            'elements' => (object) [
                'elemA' => [
                    0 => (object) [
                        'elemB' => 'Foo',
                        'elemC' => 'Bar'
                    ],
                    1 => (object) [
                        'elemB' => 'Foz',
                        'elemC' => 'Baz'
                    ]
                ]
            ]
        ];

        $this->sendResponse($returnedDatas);
    }

    public function postRequest()
    {
        $modele = new \Modeles\Books;
        //We consider to have some checks of the datas here.
        $status = $modele->updateBooks($this->datas);

        $response = (object) [
            'status' => $status,
        ];
        $this->sendResponse($response);
    }
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity66

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 ~36 days

Recently: every ~0 days

Total

16

Last Release

3495d ago

Major Versions

1.0.x-dev → 2.0.0-rc.12016-10-23

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

2.0.0-rc.1PHP &gt;=5.6.0

2.0.0-rc.10PHP ^7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8878310e46e073ed70452f0f16ebb5bf177a484811e2b19b2f48d8e2035279a8?d=identicon)[bulton-fr](/maintainers/bulton-fr)

---

Top Contributors

[![bulton-fr](https://avatars.githubusercontent.com/u/2345417?v=4)](https://github.com/bulton-fr "bulton-fr (73 commits)")

---

Tags

apimodulebfw

### Embed Badge

![Health badge](/badges/bulton-fr-bfw-api/health.svg)

```
[![Health](https://phpackages.com/badges/bulton-fr-bfw-api/health.svg)](https://phpackages.com/packages/bulton-fr-bfw-api)
```

PHPackages © 2026

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