PHPackages                             shahghasiadil/laravel-bruno-generator - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. shahghasiadil/laravel-bruno-generator

ActiveLibrary[Testing &amp; Quality](/categories/testing)

shahghasiadil/laravel-bruno-generator
=====================================

Generate Bruno API collections from Laravel routes with automatic request body inference and environment support

v1.0.2(3mo ago)26764↑213.3%2[1 PRs](https://github.com/shahghasiadil/laravel-bruno-generator/pulls)MITPHPPHP ^8.3CI passing

Since Dec 20Pushed 2w agoCompare

[ Source](https://github.com/shahghasiadil/laravel-bruno-generator)[ Packagist](https://packagist.org/packages/shahghasiadil/laravel-bruno-generator)[ Docs](https://github.com/shahghasiadil/laravel-bruno-generator)[ RSS](/packages/shahghasiadil-laravel-bruno-generator/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (35)Versions (8)Used By (0)

Laravel Bruno Generator
=======================

[](#laravel-bruno-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/218244f97fe00f6fd0a6f7711507089633a6fc43dfb646ea33010e6adf317e88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368616867686173696164696c2f6c61726176656c2d6272756e6f2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shahghasiadil/laravel-bruno-generator)[![Total Downloads](https://camo.githubusercontent.com/28158dcd6a626d86122f774976af7e34d920d198988a3c2efec8ace917517eef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368616867686173696164696c2f6c61726176656c2d6272756e6f2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shahghasiadil/laravel-bruno-generator)

Generate [Bruno](https://www.usebruno.com/) API collections from Laravel routes.

This package analyzes your Laravel application's routes and generates a ready-to-use Bruno collection, complete with request bodies inferred from FormRequests, authentication configuration, environment files, and more.

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

[](#installation)

You can install the package via composer:

```
composer require shahghasiadil/laravel-bruno-generator --dev
```

Publish the config file:

```
php artisan vendor:publish --tag=bruno-generator-config
```

Quick Start
-----------

[](#quick-start)

Generate a collection:

```
php artisan bruno:generate
```

Default output:

```
bruno/collections/Laravel-API/

```

Open that folder in Bruno using `Open Collection`.

Features
--------

[](#features)

- One-command generation from Laravel routes
- FormRequest body inference
- Route filtering (middleware, prefix, include/exclude)
- Multiple organization strategies (`prefix`, `controller`, `tag`, `none`)
- Auth support (`none`, `bearer`, `basic`, `oauth2`)
- Multi-environment generation (`Local`, `Staging`, `Production` by default)
- Optional docs, tests, and scripts generation
- `.bru` and YAML output support
- Deterministic, git-friendly generated files

Usage
-----

[](#usage)

### Common commands

[](#common-commands)

Generate with default settings:

```
php artisan bruno:generate
```

Generate YAML output:

```
php artisan bruno:generate --format=yaml
```

Generate only API routes protected by Sanctum:

```
php artisan bruno:generate --api-only --middleware=auth:sanctum
```

Generate with docs and tests:

```
php artisan bruno:generate --with-docs --with-tests
```

Preview without writing files:

```
php artisan bruno:generate --dry-run
```

Overwrite existing output:

```
php artisan bruno:generate --force
```

Clear generated collection:

```
php artisan bruno:clear
```

Clear a custom path:

```
php artisan bruno:clear path/to/collection --force
```

### All generate options

[](#all-generate-options)

```
php artisan bruno:generate \
  --format=bru|yaml \
  --output=path/to/output \
  --name="My API" \
  --api-only \
  --prefix=api/v1 \
  --exclude-prefix=admin \
  --middleware=auth:sanctum \
  --exclude-middleware=web \
  --group-by=prefix|controller|tag|none \
  --with-body-inference \
  --with-tests \
  --with-scripts \
  --with-docs \
  --force \
  --dry-run
```

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

[](#configuration)

You can control most behavior through `.env`:

```
BRUNO_OUTPUT_PATH=bruno/collections
BRUNO_COLLECTION_NAME="Laravel API"
BRUNO_OUTPUT_FORMAT=bru
BRUNO_GROUP_BY=prefix
BRUNO_INFER_BODY=true
BRUNO_AUTH_MODE=bearer

APP_URL=http://localhost:8000
STAGING_URL=https://staging.example.com
PRODUCTION_URL=https://api.example.com
```

After publishing, full options are available in `config/bruno-generator.php`.

### Key config sections

[](#key-config-sections)

- `output_path`, `collection_name`, `output_format`
- `route_discovery` for include/exclude rules
- `organization` for grouping and sorting
- `request_generation` for body/query/header behavior
- `auth` for mode and auth middleware detection
- `environments` for generated Bruno environments
- `advanced` for docs length, tests, scripts, YAML options, request settings

FormRequest Body Inference
--------------------------

[](#formrequest-body-inference)

When enabled, request bodies are generated from your FormRequest rules.

Example FormRequest rules:

```
public function rules(): array
{
    return [
        'name' => 'required|string|max:255',
        'email' => 'required|email',
        'age' => 'integer|min:18',
        'is_active' => 'boolean',
        'tags' => 'array',
        'tags.*' => 'string',
    ];
}
```

Example generated body:

```
{
  "name": "Name",
  "email": "user@example.com",
  "age": 18,
  "is_active": true,
  "tags": [""]
}
```

Nested rules like `user.name` and `user.email` are also supported.

Output Formats
--------------

[](#output-formats)

Both output formats are supported:

- `bru` (default)
- `yaml`

Use command flag:

```
php artisan bruno:generate --format=yaml
```

Or environment variable:

```
BRUNO_OUTPUT_FORMAT=yaml
```

Environments
------------

[](#environments)

By default, the package generates:

- `Local`
- `Staging`
- `Production`

Each environment contains values like `baseUrl` and `authToken` and can be switched in Bruno.

You can add custom environments (for example `Development`, `QA`, `UAT`) in `config/bruno-generator.php`.

Generated Structure
-------------------

[](#generated-structure)

Typical output:

```
bruno/collections/Laravel-API/
  bruno.json
  environments/
    Local.bru
    Staging.bru
    Production.bru
  api/
    ...requests and folders...

```

Best Practices
--------------

[](#best-practices)

- Use `--dry-run` before first full generation
- Keep route filters explicit in larger projects
- Commit generated collections to track API changes
- Keep environment URLs in `.env`
- Do not commit real auth tokens

Testing
-------

[](#testing)

Run tests:

```
composer test
```

Run static analysis:

```
composer analyse
```

Format code:

```
composer format
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security-related issues, please email .

Credits
-------

[](#credits)

- [Shahghasi Adil](https://github.com/shahghasiadil)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Total

3

Last Release

109d ago

PHP version history (2 changes)v1.0.0PHP ^8.1|^8.2|^8.3

v1.0.2PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a0a3bb25b5438613463e20699f30cc02e24a0e57e7d171208e3d19bd6bf7b4a?d=identicon)[shahghasiadil](/maintainers/shahghasiadil)

---

Top Contributors

[![shahghasiadil](https://avatars.githubusercontent.com/u/64509320?v=4)](https://github.com/shahghasiadil "shahghasiadil (44 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

apiapi-clientbrunocollectiondevelopement-toolslaravellaravel-brunotestingtesting-toolstestingapilaravelgeneratorcollectionapi clientdevelopment-toolsbruno

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/shahghasiadil-laravel-bruno-generator/health.svg)

```
[![Health](https://phpackages.com/badges/shahghasiadil-laravel-bruno-generator/health.svg)](https://phpackages.com/packages/shahghasiadil-laravel-bruno-generator)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/folio

Page based routing for Laravel.

603583.7k33](/packages/laravel-folio)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
