andreaselia/laravel-api-to-postman

Export command says that postman collection was exported but no JSON file created

patrick-simard opened this issue · 4 comments

Hey guys,
I am using Laravel 8, PHP 8. I am trying to generate a postman collection out of my API.

I installed this package and used the php artisan export:postman command

www@f86a5c7089bb:/var/www$ php artisan export:postman --bearer="4|hidden"
Postman Collection Exported: postman/2022_02_19_173418_on_account_collection.json

also tried

www@f86a5c7089bb:/var/www$ php artisan export:postman
Postman Collection Exported: postman/2022_02_19_172712_on_account_collection.json

It says it generated a json file but it's not generated. (Nowhere to be found)

I am trying to generate this from docker in my local envirement

my config files looks like this:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Base URL
    |--------------------------------------------------------------------------
    |
    | The base URL for all of your endpoints.
    |
    */

    'base_url' => env('APP_URL', 'http://localhost:1111'),

    /*
    |--------------------------------------------------------------------------
    | Collection Filename
    |--------------------------------------------------------------------------
    |
    | The name for the collection file to be saved.
    |
    */

    'filename' => '{timestamp}_{app}_collection.json',

    /*
    |--------------------------------------------------------------------------
    | Structured
    |--------------------------------------------------------------------------
    |
    | If you want folders to be generated based on namespace.
    |
    */

    'structured' => false,

    /*
    |--------------------------------------------------------------------------
    | Auth Middleware
    |--------------------------------------------------------------------------
    |
    | The middleware which wraps your authenticated API routes.
    |
    | E.g. auth:api, auth:sanctum
    |
    */

    'auth_middleware' => 'auth:api',

    /*
    |--------------------------------------------------------------------------
    | Headers
    |--------------------------------------------------------------------------
    |
    | The headers applied to all routes within the collection.
    |
    */

    'headers' => [
        [
            'key' => 'Accept',
            'value' => 'application/json',
        ],
        [
            'key' => 'Content-Type',
            'value' => 'application/json',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Enable Form Data
    |--------------------------------------------------------------------------
    |
    | Determines whether or not form data should be handled.
    |
    */

    'enable_formdata' => true,

    /*
    |--------------------------------------------------------------------------
    | Form Data
    |--------------------------------------------------------------------------
    |
    | The key/values to requests for form data dummy information.
    |
    */

    'formdata' => [
        // 'email' => 'john@example.com',
        // 'password' => 'changeme',
    ],

    /*
    |--------------------------------------------------------------------------
    | Include Middleware
    |--------------------------------------------------------------------------
    |
    | The routes of the included middleware are included in the export.
    |
    */

    'include_middleware' => ['api'],

    /*
    |--------------------------------------------------------------------------
    | Disk Driver
    |--------------------------------------------------------------------------
    |
    | Specify the configured disk for storing the postman collection file.
    |
    */

    'disk' => 'local',

];

Geez ... I just found out it generates in storage/app folder >.<

@patrick-simard glad you managed to figure it out.

I'll take a look at updating the output to be the full path, rather than just the postman directory.

Resolved in #65

Wow! Now that is awesome support! Thanks @andreaselia !