This is an alternate to swagger editor and swagger-ui, to create api documentation. Instead of writing yaml codes, all you have to do is to fill a simple CRUD form.
- PHP >= 5.5.9
- SQLite extension activated / MySql
Pull dependencies using composer
composer update
-
Update Configuration file located at
api_docs/generator/config/config.php
define('DB_DRIVER', 'mysql'); define('DB_HOST', '127.0.0.1'); define('DB_NAME', 'api_docs'); define('DB_USER', 'root'); define('DB_PASS', 'root');
-
Migrate the database tables
example.com/api_docs/generator/migrate
-
Optional: Seed the tables
example.com/api_docs/generator/seed
-
Edit 'host' in
api_docs/generator/controller/makejson.php
'swagger' => '2.0', 'info' => array( 'version' => '0.0.1', 'title' => 'MY REST API' ), 'host' => 'example.com', 'basePath' => '/api_docs', 'schemes' => [ 'http', 'https' ],
-
Make storage folder writable. Browse to
api_docs/generator
sudo chmod -R 777 storage
-
Generate JSON file
example.com/api_docs/generator/makejson
-
Add url to swagger-ui component
api_docs/public/index.html Line:35
if (url && url.length > 1) { url = decodeURIComponent(url[1]); } else { url = "http://example.com/api_docs/generator/storage/appx.json"; }
-
All done!
- To add/update/delete api routes, browse:
example.com/api_docs/generator
- To view/test api routes, browse:
example.com/api_docs/public
- To add/update/delete api routes, browse: