frowhy/swagger2postman

Swagger Json Convert To Postman Json

v2.0.8 2016-12-20 02:55 UTC

This package is auto-updated.

Last update: 2024-10-29 05:04:48 UTC


README

Installation

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:

composer require frowhy/swagger2postman

Examples

use Frowhy\Swagger2Postman;

require_once __DIR__ . '/vendor/autoload.php';
header('Content-type: application/json');

$swagger2Postman = new Swagger2Postman();
$state = $swagger2Postman
    ->openFile('swagger.json')
    ->convertPostman()
    ->writeFile('postman.json');

$handle = fopen('swagger.json', 'r');
$swagger = fread($handle, filesize('swagger.json'));
fclose($handle);
$swagger2Postman = new Swagger2Postman();
$state = $swagger2Postman
    ->setSwagger($swagger)
    ->convertPostman()
    ->writeFile('postman.json');

$postman = $swagger2Postman
    ->openFile('swagger.json')
    ->convertPostman()
    ->getPostman();

echo $postman;