codersandip/telescope-exporter

Convert Laravel Telescope requests to Postman Collections and cURL commands

Maintainers

Package info

github.com/codersandip/telescope-exporter

Language:Blade

pkg:composer/codersandip/telescope-exporter

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-30 07:20 UTC

This package is auto-updated.

Last update: 2026-05-01 14:29:32 UTC


README

Convert captured Laravel Telescope request entries into Postman Collection v2.1 JSON and formatted cURL commands.

Package name:

codersandip/telescope-exporter

Features

  • Export a Telescope request entry as a formatted cURL command.
  • Export a Telescope request entry as a Postman Collection v2.1 JSON document.
  • Browser view with download buttons for both formats.
  • Paste a full Telescope request URL and let the package extract the request UUID.
  • Async export generation in the browser without a full page reload.
  • Copy buttons for cURL and Postman Collection output.
  • Loading state while the request entry is being fetched.
  • Dark and light theme toggle with the choice saved in the browser.
  • Builds full-domain cURL and Postman URLs when Telescope stored a relative request URI.
  • JSON endpoint for integrations or custom UI work.
  • Uses Telescope's configured domain and middleware, so access follows the same Telescope authorization rules.
  • Compatible with Laravel 8, 9, 10, and 11.

Requirements

  • PHP 7.3 or newer
  • Laravel 8, 9, 10, or 11
  • Laravel Telescope 4 or 5

Composer will still enforce the PHP and framework requirements of the Laravel and Telescope versions installed in your application.

Installation

Install the package with Composer:

composer require codersandip/telescope-exporter

Laravel package discovery registers the service provider automatically.

If package discovery is disabled, add the provider manually in config/app.php:

'providers' => [
    Codersandip\TelescopeExporter\TelescopeExportServiceProvider::class,
],

Telescope Setup

This package reads request entries from Telescope's storage. Make sure Telescope is installed and migrated:

composer require laravel/telescope
php artisan telescope:install
php artisan migrate

Telescope must be recording request entries. If your application filters Telescope entries, confirm that request entries are not being filtered out.

Publishing Config

Publish the config file:

php artisan vendor:publish --tag=telescope-exporter-config

The published file is:

config/telescope-exporter.php

Default config:

return [
    'path' => env('TELESCOPE_EXPORTER_PATH', 'telescope-api'),
];

You may change the route prefix with:

TELESCOPE_EXPORTER_PATH=telescope-api

Publishing Views

Publish the Blade view if you want to customize the export screen:

php artisan vendor:publish --tag=telescope-exporter-views

The published view will be placed at:

resources/views/vendor/telescope-exporter/export.blade.php

Routes

The default route prefix is /telescope-api.

Method URI Description
GET /telescope-api/export Browser form for pasting a full Telescope request URL
GET /telescope-api/export/resolve?telescope_url=... Extracts the request UUID and redirects to the export page
GET /telescope-api/export/{uuid} Browser export page with preview and download buttons
GET /telescope-api/export/{uuid}/json JSON response containing both cURL and Postman exports
GET /telescope-api/export/{uuid}/download/curl Downloads a .sh file containing the cURL command
GET /telescope-api/export/{uuid}/download/postman Downloads a Postman Collection v2.1 JSON file

The {uuid} value must be the UUID of a Telescope entry where type is request.

Usage

Open the exporter page:

/telescope-api/export

Paste the full Telescope request URL, for example:

https://your-app.test/telescope/requests/00000000-0000-0000-0000-000000000000

The package extracts the UUID and redirects to:

/telescope-api/export/{uuid}

The browser page displays:

  • A cURL preview
  • A Postman Collection JSON preview
  • Copy buttons for both previews
  • A Download cURL button
  • A Download Collection button
  • A loader while the export data is fetched
  • A dark/light mode toggle

You can also open a UUID directly:

/telescope-api/export/{uuid}

When using the pasted URL flow, the package keeps the source domain in the generated links. If Telescope stored a relative URI like /api/users, the cURL output will use a full URL like https://your-app.test/api/users.

JSON Response

Request:

GET /telescope-api/export/{uuid}/json

Example response:

{
  "uuid": "request-entry-uuid",
  "type": "request",
  "curl": "curl --request POST \\\n  --url 'https://example.test/api/users'",
  "postman": {
    "info": {
      "_postman_id": "request-entry-uuid",
      "name": "Telescope Export request-entry-uuid",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
      {
        "name": "POST /api/users",
        "request": {
          "method": "POST",
          "header": [],
          "url": "https://example.test/api/users"
        }
      }
    ]
  }
}

Exported Data

The package reads the Telescope content column for request entries and maps:

  • method to cURL --request and Postman request.method
  • uri or url to cURL --url and Postman request.url
  • headers to cURL --header and Postman request.header
  • payload to cURL --data-raw and Postman request.body

Payload arrays are encoded as JSON.

The captured Host header is intentionally omitted from generated exports. cURL and Postman derive the host from the request URL, which avoids conflicts when the source domain is resolved or changed.

If the captured Telescope URL is relative, the package resolves it against:

  1. The domain from the pasted Telescope request URL.
  2. config('app.url').
  3. The current request host.

Internally, the package reads request entries through Telescope's storage model:

Laravel\Telescope\Storage\EntryModel

Security

Routes are registered with:

  • config('telescope.domain')
  • config('telescope.middleware')

By default, this means the export routes use the same authorization gate and middleware stack as Telescope. Users who cannot access Telescope should not be able to access these export routes.

Review exported requests before sharing them. Telescope may contain headers, cookies, bearer tokens, API keys, or request payload fields captured from your application.

Laravel 8 Notes

Laravel 8 is supported by the package constraints:

{
  "php": "^7.3|^8.0",
  "illuminate/support": "^8.0|^9.0|^10.0|^11.0",
  "laravel/telescope": "^4.0|^5.0"
}

If Composer cannot resolve dependencies in a Laravel 8 application, check the installed Telescope version and PHP version first. Older Laravel 8 projects commonly need a Telescope 4 release, while newer PHP 8 based Laravel 8 projects may resolve newer Telescope versions.

Package Structure

config/
  telescope-exporter.php
routes/
  web.php
resources/
  views/
    export.blade.php
src/
  TelescopeExportServiceProvider.php
  Http/
    Controllers/
      TelescopeExportController.php
  Services/
    CurlGeneratorService.php
    PostmanGeneratorService.php

Troubleshooting

If the export route returns 404, confirm the UUID belongs to a Telescope entry where type is request.

If the pasted URL form cannot find a UUID, confirm the URL contains a standard UUID value from a Telescope request detail page.

If the export route returns 403, check your Telescope authorization gate and middleware.

If the route does not exist, clear cached routes:

php artisan route:clear
php artisan optimize:clear

If a request body is missing, confirm Telescope captured the request payload and that your Telescope configuration is not hiding or filtering the field.

If you see Class "Laravel\Telescope\Models\EntryModel" not found, update the package code to use Telescope's correct model namespace:

use Laravel\Telescope\Storage\EntryModel;

License

MIT