PHPackages                             devtools-marvellous/postman-documentation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. devtools-marvellous/postman-documentation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

devtools-marvellous/postman-documentation
=========================================

Package description

1.2.12(1y ago)0536PHP

Since Oct 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/devtools-marvellous/postman-documentation)[ Packagist](https://packagist.org/packages/devtools-marvellous/postman-documentation)[ RSS](/packages/devtools-marvellous-postman-documentation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (6)

Postman Documentation Exporter
==============================

[](#postman-documentation-exporter)

This package implements powerful postman json exporter in 2.1.1 json version.

Package integrated with `amondar/rest-actions` right of the box.

> NOTE!!! Please, don't use this exporter for none API routes, that will cause problems with session management during exporting.

Installation
------------

[](#installation)

To install this package:

- Add to your `composer.json`:

```
{
  "repositories": [
      {"type": "composer", "url": "https://repo.packagist.com/attractgroup/"}
  ]
}
```

- Authenticate your composer to work with private `attractgroup` repo.

```
composer config --global --auth http-basic.repo.packagist.com ${USER} ${AUTH_TOKEN}
```

- Then execute:

```
composer require attract-cores/postman-documentation
```

After that you can run artisan command:

```
php artisan export:postman
```

All created json docs will be saved at `/storage/app/public/postman/*` directory inside your project.

Configuration
-------------

[](#configuration)

SettingExplanation`filename`Default file pattern is - `{timestamp}_{app}_collection.json`. You can change it into what ever you want. Replacement engine can work with: `{timestamp}`, `{app}``structured`This flag determine, that json output routes tree should be structured by name\\url segments separated via dot(`.`)`oauth_route`Name of the oauth token issuing route. Works in pair with `auth_type` setting. If your project don't have this kind of route, then set it to `NULL``auth_type`Type of routes authentication. Works in pair with `auth_middleware`. Accept: `oauth2`, `token`, `none`. [For More information read docs below](#authorization-types-and-tricks)`token_placement`"Add To" postman option value. Can be only `header` or `query`. Works only via `auth_type=token``auth_middleware`The name of auth middleware. If route has this middleware, then exporter apply selected `auth_type` setting blocks into route json`client_auth_middleware`The name of client auth middleware. If route has this middleware, then exporter apply `client_credentials` grant authorization`auth_clients`Array of settings that applied into `password` or `client_credentials` grant type authorization`scopes`Array of route patterns to determine which scopes should be applied in `oauth2` type`start-user`Credentials of given user will be used for `password` grant authorization. After exporting, end user can change this credentials for his user`headers`Headers pack, that required for each route`enable_formdata`Enable or disable form data generation for each route. Works in pair with `factories_path`. [For More information read docs below](#form-data-from-form-factories)`factories_path`Path to request form data factories classes`include_middleware`Array of base middlewares, that should be added into export. By default, only `api` middleware used`disk`Disk of storage that should be used for json result file store. By default, `public` driver used### Authorization types and tricks

[](#authorization-types-and-tricks)

Package support several authentication types:

- `oauth2`
- `token`
- `none`

When `none` type used, result routes will be created with empty `auth` blocks. That option preferable on old projects with custom authentication system.

When `token` type used, result routes will be created with simple `Api Key` authorization option. In that case, end user, after import should place `api_key` into each route manually.

When `oauth2` type used, result routes will be created with `OAuth 2.0` authorization option. Depends on middleware settings `auth_middleware` or `client_auth_middleware`will be user `password` or `client_credentials` grant types. On some projects can be implemented anonymous authorization. In at case you can run command with configured `auth_type=oauth2` and add `--personal-access` option.

```
php artinsan export:postman --personal-access={{user_access_token}}
```

In that case will be added `Bearer Token` authorization option to each route. That trick can be used on old projects, that used passport, but doesn't have opened `token` route. Just run command as described above without changing.

### Form data from form factories

[](#form-data-from-form-factories)

If command ran with `enable_formdata=true` then you can specify form factory for each route for each request type: `POST`, `PUT`, `PATCH`, `GET`, `DELETE`. By default, all factories should be placed in `./app/Postman` directory.

Each factory should be named by a pattern below and extends core factory class, just like a standard model factories in laravel:

```
${FULL_REQUEST_NAME}Factory.php

#For example

UserProfileRequestFactory.php
```

All factories loaded into memory each time, when command dispatched.

Example of factory class looks like below:

```
