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)155373[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 today

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 57% 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

4177d 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

3.0k37.6M132](/packages/darkaonline-l5-swagger)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.4k67.4M262](/packages/nelmio-api-doc-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M568](/packages/shopware-core)[tangwei/apidocs

A swagger library for Hyperf.

53137.0k8](/packages/tangwei-apidocs)[hyperf/swagger

A swagger library for Hyperf.

20371.1k7](/packages/hyperf-swagger)[pimcore/studio-backend-bundle

Pimcore Studio Backend Bundle

20203.9k22](/packages/pimcore-studio-backend-bundle)

PHPackages © 2026

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