static public function register(Application $app,
                                    callable $callback = null,
                                    $prefix='/docs')
    {
        $app->addRoute('GET', $prefix.'/swagger.json', function (Application $app)use($callback){
            $swagger = new Swagger();
            $swagger->appendControllers($app, $app->getControllers());
            if($callback){
                $callback($swagger);
            }
            return new Response($swagger->toJson());
        });
    }
static public function register(Application $app,
                                    callable $callback = null,
                                    $prefix='/docs')
    {
        $app->addRoute('GET', $prefix.'/swagger.json', function (Application $app)use($callback){
            $swagger = new Swagger();
            $swagger->appendControllers($app, $app->getControllers());
            if($callback){
                $callback($swagger);
            }
            return new Response($swagger->toJson());
        });
    }
static public function register ( Application $ app , callable $ callback = null , $ prefix = '/docs' ) { $ app -> addRoute ( 'GET' , $ prefix . '/swagger.json' , function ( Application $ app ) use ( $ callback ) { $ swagger = new Swagger ( ) ; $ swagger -> appendControllers ( $ app , $ app -> getControllers ( ) ) ; if ( $ callback ) { $ callback ( $ swagger ) ; } return new Response ( $ swagger -> toJson ( ) ) ; } ) ; }
How to use

SwaggerProvider::register($app, function(Swagger $swagger){
$swagger->host = 'api.example.com',
$swagger->info->description = '...';
...
},
'/docs')

@param Application $app
@param string $prefix
@param callable $callback
@return void
How to use