PHPackages                             terwey/slim-swagger - 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. terwey/slim-swagger

ActiveLibrary[API Development](/categories/api)

terwey/slim-swagger
===================

Slim Middleware for generating Swagger documentation on the fly with Swagger-PHP

0.0.3(11y ago)155353[1 issues](https://github.com/terwey/SlimSwagger/issues)MITPHP

Since Jan 24Pushed 11y ago1 watchersCompare

[ Source](https://github.com/terwey/SlimSwagger)[ Packagist](https://packagist.org/packages/terwey/slim-swagger)[ RSS](/packages/terwey-slim-swagger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

SlimSwagger
===========

[](#slimswagger)

A Slim Middleware for generating Swagger documentation on the fly with Swagger-PHP.

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

[](#installation)

Easiest is using Composer:

```
composer require terwey/slim-swagger

```

Adding it to Slim is easy too:

```
$app->add(new \terwey\SlimSwagger(array(), array('baseDir' => __DIR__.'/../src/')));

```

Where `src/` is the directory you keep your API endpoint or Models.

Resources
---------

[](#resources)

For now you'll have to grab a release of [Swagger-UI](https://github.com/swagger-api/swagger-ui) and copy `/lib` and `/css` to your `/public` directory. Also copy over `swagger-ui.min.js` to the `/public/lib` directory.

Template
--------

[](#template)

I've provided a Twig template in the `/templates` directory. Copy this over to your Slim application. If you want to use Twig also install [Slim Views](https://github.com/codeguy/Slim-Views).

Docs
====

[](#docs)

The SlimSwagger class takes 2 parameters. The first one is the `$swaggerSettings` array, please see the Swagger-PHP docs for more info.

```
$swaggerSettings = array(
    'output' => 'json',
    'apiVersion' => $defaultApiVersion,
    'swaggerVersion' => $defaultSwaggerVersion,
    'defaultSwaggerVersion' => $resourceList['swaggerVersion'],
    'defaultBasePath' => $defaultBasePath
);

```

The second one is the `$options` array.

```
$options = array(
    'baseDir' => __DIR__.'/../',
    'ignoreDir' => array()
);

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

Every ~0 days

Total

2

Last Release

4127d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cac999bef96a7cfd9aeffcdcb282aa6116a4444ce8e2ca8241be075ad964a6f?d=identicon)[terwey](/maintainers/terwey)

---

Top Contributors

[![terwey](https://avatars.githubusercontent.com/u/1596124?v=4)](https://github.com/terwey "terwey (11 commits)")

### Embed Badge

![Health badge](/badges/terwey-slim-swagger/health.svg)

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

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3372.3M3](/packages/darkaonline-swagger-lume)[jlapp/swaggervel

A great way to integrate Swagger into Laravel

492931.6k2](/packages/jlapp-swaggervel)[light/yii2-swagger

swagger intergation with yii2

154801.6k4](/packages/light-yii2-swagger)[yii2mod/yii2-swagger

Swagger Documentation Generator for Yii2 Framework

63384.7k9](/packages/yii2mod-yii2-swagger)[alt3/cakephp-swagger

Instant Swagger documentation for your CakePHP 4.x APIs

64197.3k3](/packages/alt3-cakephp-swagger)

PHPackages © 2026

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