This third-party plugin for CodeIgniter 4 allows automatic generation of Swagger documentation for your API. Swagger is a powerful tool for documenting and testing REST APIs, making collaboration between developers and other stakeholders more efficient.
-
Clone the repository or download the plugin files:
Clone this repository or download it into the
app/ThirdParty
directory of your CodeIgniter project.git clone git@github.com:arbims/Swagger-ci.git app/ThirdParty/Swagger
-
Open the app/Config/Autoload.php file and add the plugin path in the $psr4 section.
public $psr4 = [
APP_NAMESPACE => APPPATH,
'Config' => APPPATH . 'Config',
'Swagger' => APPPATH . 'ThirdParty/Swagger/src',
];
- install zircote
composer require zircote/swagger-php
- Generate Assets
php spark swagger:assets
- Generate Swagger Doc
php spark swagger:generate
php spark serve
- check your local server