Skip to content
A SlimPHP middleware for generating swagger json documentation for use with Swagger UI
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Slagger refactor: make scanning classes lazy loaded Sep 26, 2014
.gitignore Initial commit of code. Mar 19, 2013 docs: update bold Sep 26, 2014
composer.json chore: bump php version dependency Sep 26, 2014


A Slim PHP middleware for generating swagger json for use with Swagger UI. This middleware will automatically add swagger json endpoints for all your Swagger doc annotated classes. Uses Zircote Swagger-php to parse annotations.

Install Using Composer

    "require": {
        "scrumptious\slagger": "0.3.0"


$app = new \Slim\Slim();

// Inject as Slim application middleware
$app->add(new \Slagger\Slagger('/api/v1/docs', __DIR__.'/../lib'));

\\ ... your app code


You'd then input the url in the Swagger-UI interface.

Slagger(docsuri, scandir, options)

The constructor takes up to three arguments.

####docsuri The uri in your app that will return swagger json.

####scandir The directory to scan for files with Swagger annotations.

####options [optional] Options passed through to the getResource function of the Zircote swagger-php library.


The Zircote Swagger-php library will parse the Swagger annotations in your files. See the Swagger-php docs for what annotations are supported.


 * @SWG\Resource(
 *     apiVersion="0.1",
 *     swaggerVersion="1.2",
 *     resourcePath="/journey",
 *     basePath=""
 * )
class Journey extends CRUD {
	// ...
You can’t perform that action at this time.