frowhy/swagger2postman

Swagger Json Convert To Postman Json

Installs: 71

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/frowhy/swagger2postman

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

This package is auto-updated.

Last update: 2025-09-29 02:06:03 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;