Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Postman Collection Generator Laravel Package

api-platform/postman-collection-generator

View on GitHub
Deep Wiki
Context7

PostmanGeneratorBundle

This bundle is not necessary anymore if you use API Platform 2.0 or superior. API Platform now supports natively Swagger and Postman is able to create collections from a Swagger documentation.

Generator for Postman collection based on API Platform.

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Dependency Status

Installation

Install this bundle through Composer:

composer require --dev api-platform/postman-collection-generator

Using Symfony, update your AppKernel.php file:

public function registerBundles()
{
    ...
    if ($this->getEnvironment() != 'prod') {
        ...
        $bundles[] = new PostmanGeneratorBundle\PostmanGeneratorBundle();
    }
}

Configuration

This library requires some configuration. Edit your app/config_dev.yml file as following:

postman_generator:
    name: Name of your API                  # Required
    description: Description of your API    # Optional, default: null
    baseUrl: http://www.example.com         # Required
    public: false                           # Optional, default: false
    authentication: oauth2                  # Optional, default: null
    defaultLocale: fr_FR                    # Optional, default: en_GB

Usage

This bundle provides a unique command to automatically generate a Postman collection based on your API Platform project configuration. Run php app/console postman:collection:build --help for more details.

Use parsers

This library provides a simple way to extend it, called parsers. There are 2 of them: request parsers & command parsers.

Request parsers

Request parsers are services executed to edit Postman requests before being sent to collection. You can, for example, add a custom authentication header, add some tests, etc.

To create your own request parser, your service must implement PostmanGeneratorBundle\RequestParser\RequestParserInterface, and has a tag postman.request_parser.

Careful: some request parsers may be executed before yours. Check for priority process in Symfony Dependency Injection.

Command parsers

Command parsers are services executed to connect to the main command, for example to ask for authentication access.

To create your own command parser, your service must implement PostmanGeneratorBundle\CommandParser\CommandParserInterface, and has a tag postman.command_parser. parse method allows you to ask questions to user, and execute method to do your stuff.

Careful: some command parsers may be executed before yours. Check for priority process in Symfony Dependency Injection.

Authentication

By default, this library can manage OAuth2 authentication. To use it, fill authentication configuration key using oauth2. When using main command, you will be prompt for some login/password. They will be managed as environment variables in Postman.

Feel free to add your own authenticators as request & command parsers.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor