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

ActiveLibrary[Framework](/categories/framework)

matthiasmullie/php-api
======================

A neat little framework for creating PHP APIs

1.0.0(8y ago)6420MITPHPPHP ^7.0

Since Dec 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/matthiasmullie/php-api)[ Packagist](https://packagist.org/packages/matthiasmullie/php-api)[ Docs](https://github.com/matthiasmullie/php-api)[ RSS](/packages/matthiasmullie-php-api/feed)WikiDiscussions master Synced 4d ago

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

php-api
=======

[](#php-api)

[![Build status](https://camo.githubusercontent.com/1fbcf9ac6cda89bc92ac0f61759fbab241653542a2951618105a9d50861d02a7/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d617474686961736d756c6c69652f7068702d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/matthiasmullie/php-api)[![Code coverage](https://camo.githubusercontent.com/dcd3fa41901e630ca85b68557ec756a85a3b66596a47a15d3b72e240b17b09e0/687474703a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d617474686961736d756c6c69652f7068702d6170692e737667)](https://codecov.io/github/matthiasmullie/php-api)[![Code quality](https://camo.githubusercontent.com/985a3728f23b539b18de134964ef2b78179450ee299dd389a306eaac0c518f8e/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d617474686961736d756c6c69652f7068702d6170692e737667)](https://scrutinizer-ci.com/g/matthiasmullie/php-api)[![Latest version](https://camo.githubusercontent.com/0c68924f865015d303dbd91ba07aa9391c5854322d1e35ef216c99379ef6fa3b/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617474686961736d756c6c69652f7068702d6170692e737667)](https://packagist.org/packages/matthiasmullie/php-api)[![Downloads total](https://camo.githubusercontent.com/39435fe26e0eb3a427835ab3365dc0817b6af0bee73ed454c7104b04ae166bf9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617474686961736d756c6c69652f7068702d6170692e737667)](https://packagist.org/packages/matthiasmullie/php-api)[![License](https://camo.githubusercontent.com/8ad815e07f5060ec41ecae3827b2f402eb3caabf639f55b9598a13f07b1ba061/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d617474686961736d756c6c69652f7068702d6170692e737667)](https://github.com/matthiasmullie/php-api/blob/master/LICENSE)

Example usage
-------------

[](#example-usage)

Setting up is **really** simple.

You'll need a routing config:

```
test:
    method: [GET, POST]
    path: /
    handler: MatthiasMullie\ApiExample\ExampleController
```

A few lines to bootstrap, in a file where all of your requests end up:

```
$routes = new MatthiasMullie\Api\Routes\Providers\YamlRouteProvider(__DIR__.'/../config/routes.yml');
$handler = new MatthiasMullie\Api\RequestHandler($routes);
$response = $handler->route(GuzzleHttp\Psr7\ServerRequest::fromGlobals());
$handler->output($response);
```

And a controller:

```
namespace MatthiasMullie\ApiExample;

class ExampleController implements MatthiasMullie\Api\Controllers\JsonController
{
    public function __invoke(Psr\Http\Message\ServerRequestInterface $request, ResponseInterface $response, array $args)
    {
        // hey there, I can process your request!

        return [
            'status_code' => 200,
            'hello' => 'world',
        ];
    }
}
```

Or take a look at this exact same example in a clean repo, at [matthiasmullie/php-api-example](https://github.com/matthiasmullie/php-api-example).

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

[](#installation)

Simply add a dependency on matthiasmullie/php-api to your composer.json file if you use [Composer](https://getcomposer.org/) to manage the dependencies of your project:

```
composer require matthiasmullie/php-api
```

Although it's recommended to use Composer, you can actually include these files anyway you want.

License
-------

[](#license)

php-api is [MIT](http://opensource.org/licenses/MIT) licensed.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

3080d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cad3300bf52ada70b17962024941977a92a4da8551cbb92493de23c4bbbb5252?d=identicon)[matthiasmullie](/maintainers/matthiasmullie)

---

Top Contributors

[![matthiasmullie](https://avatars.githubusercontent.com/u/312776?v=4)](https://github.com/matthiasmullie "matthiasmullie (22 commits)")

---

Tags

phpapiframeworkSkeleton

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/matthiasmullie-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/matthiasmullie-php-api/health.svg)](https://phpackages.com/packages/matthiasmullie-php-api)
```

###  Alternatives

[digitalstars/simplevk

Powerful PHP library/framework for VK API bots, supporting LongPoll &amp; Callback &amp; OAuth

883.9k3](/packages/digitalstars-simplevk)[patricksavalle/slim-rest-api

Production-grade REST-API App-class for PHP SLIM, in production on https://zaplog.pro (https://api.zaplog.pro/v1)

101.4k](/packages/patricksavalle-slim-rest-api)

PHPackages © 2026

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