When you're searching for a Swagger integration that is fully automatically derived from your PHP code, you can have a look at my latest project: https://github.com/lnaegele/PSwag
This project bases on Slim and provides an OpenAPI 3.0 spec and a swagger page "on the fly" - without any manual generation steps from your side. You just need to specify datatypes to parameters and returns of your API methods.
Example: Create an endpoint function in PetApplicationService.class:
/**
* Find pet by ID
* @param int $petId ID of pet to return
* @return Pet Returns a single pet
*/
public function getPetById(int $petId): Pet {
return new Pet(...);
}
In your index.php you register the endpoint in PSwagApp which is a wrapper around SlimApp:
// create SlimApp and wrapper PSwagApp
$slimApp = AppFactory::create();
$app = new PSwagApp($slimApp);
...
// add swagger middleware
$app->addSwaggerUiMiddleware('/swagger', 'PSwag example', '1.0.0', 'vendor/swagger-api/swagger-ui/dist/');
// register endpoints by specifying class and method name
$app->get('/pet/{petId}', [PetApplicationService::class, 'getPetById']);
The result will look like this: