PHPackages                             phrity/slim-openapi - 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. phrity/slim-openapi

ActiveLibrary[API Development](/categories/api)

phrity/slim-openapi
===================

OpenApi implementation for Slim 4.

1.2.2(7mo ago)31.7k↑57.1%MITPHPPHP ^8.1CI passing

Since Sep 21Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/sirn-se/phrity-slim-openapi)[ Packagist](https://packagist.org/packages/phrity/slim-openapi)[ Docs](https://phrity.sirn.se/slim-openapi)[ RSS](/packages/phrity-slim-openapi/feed)WikiDiscussions main Synced 2d ago

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

[![Build Status](https://github.com/sirn-se/phrity-slim-openapi/actions/workflows/acceptance.yml/badge.svg)](https://github.com/sirn-se/phrity-slim-openapi/actions)[![Coverage Status](https://camo.githubusercontent.com/090a52158a510b69ac51c8e3d97c172684b1db71c395172d3e661aa86bfdda46/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7369726e2d73652f7068726974792d736c696d2d6f70656e6170692f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/sirn-se/phrity-slim-openapi?branch=master)

OpenApi for Slim v4
===================

[](#openapi-for-slim-v4)

Adapter that reads [OpenApi](https://spec.openapis.org) schema and add included routes to [Slim](https://www.slimframework.com). By defining `operationId` in OpenApi schema, the adapter will automatically instanciate and call referenced controller class.

Some features

- Automatic mapping of routes to controllers
- OpenApi specification in JSON or YAML source
- Optional validation of requests and responses

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

[](#installation)

Install with [Composer](https://getcomposer.org/);

```
composer require phrity/slim-openapi

```

How to use
----------

[](#how-to-use)

```
use Phrity\Slim\OpenApi;
use Slim\Factory\AppFactory;

// Create Slim App as you normally would
$slim = AppFactory::create();

// Create OpenApi adapter with OpenApi source
$openapi = new OpenApi('openapi.json');

// Push all routes from OpenApi to Slim
$openapi->route($slim);

// Run Slim
$slim->run();
```

How to define controllers
-------------------------

[](#how-to-define-controllers)

In order for automatic mapping to work, the `operationId` must be set on all defined routes in OpenApi source. If no method is specified, class method `__invoke()` will be called on class.

With invokeWith method `Classname``Classname:method` `Namespace/Classname``Namespace/Classname:method` `Namespace\\Classname``Namespace\\Classname:method`### Example

[](#example)

```
{
    "openapi": "3.0.0",
    "paths": {
        "/test": {
            "get": {
                "operationId": "Test/MyController",
                "description": "Will invoke on class Test\\MyController"
            },
            "put": {
                "operationId": "Test\\MyController:put",
                "description": "Will call method put() on class Test\\MyController"
            }
        }
    }
}
```

Documentation
=============

[](#documentation)

- [Basics](docs/Basics.md)
- [Settings](docs/Settings.md)
- [Validation](docs/Validation.md)
- [Extras](docs/Extras.md)

Versions
--------

[](#versions)

VersionPHP`1.2``^7.4|^8.0`Request/Response validation, YAML support`1.1``^7.4|^8.0`Settings &amp; helpers`1.0``^7.4|^8.0`Route registry

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance65

Regular maintenance activity

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Total

5

Last Release

210d ago

PHP version history (3 changes)1.0.0PHP ^7.4 || ^8.0

1.1.0PHP ^7.4 | ^8.0

1.2.2PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4255391?v=4)[Sören Jensen](/maintainers/sirn-se)[@sirn-se](https://github.com/sirn-se)

---

Top Contributors

[![sirn-se](https://avatars.githubusercontent.com/u/4255391?v=4)](https://github.com/sirn-se "sirn-se (32 commits)")

---

Tags

openapiphpphp-libraryslimslim-frameworkrouteropenapislimrouting

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phrity-slim-openapi/health.svg)

```
[![Health](https://phpackages.com/badges/phrity-slim-openapi/health.svg)](https://phpackages.com/packages/phrity-slim-openapi)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5733.3M47](/packages/thecodingmachine-graphqlite)

PHPackages © 2026

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