PHPackages                             abdo-taher/laraswagger - 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. [API Development](/categories/api)
4. /
5. abdo-taher/laraswagger

ActiveLibrary[API Development](/categories/api)

abdo-taher/laraswagger
======================

Auto-generate Swagger-style API documentation for Laravel projects

10PHP

Since Jan 29Pushed 3mo agoCompare

[ Source](https://github.com/abdo-taher/laraswagger)[ Packagist](https://packagist.org/packages/abdo-taher/laraswagger)[ RSS](/packages/abdo-taher-laraswagger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

It looks like you are working with a Laravel package called **LaraSwagger**, which automatically generates Swagger/OpenAPI documentation for your Laravel API. Below is a detailed breakdown of the package features, installation instructions, configuration, and usage steps, along with the corresponding code files.

### **Features of LaraSwagger:**

[](#features-of-laraswagger)

1. **Auto-detect API routes** (`api/*` routes).
2. **Detect route parameters** and **query parameters** from controller methods.
3. **Extract validation rules** from `FormRequest` classes automatically.
4. **Auto-capture GET responses** for example data.
5. **Supports authentication** (via Bearer token or login endpoint).
6. **Laravel auto-discovery** via a service provider.

---

### **Installation Instructions:**

[](#installation-instructions)

To install **LaraSwagger** via Composer directly from Git, follow these steps:

1. **Require the package using Composer:**

    Run the following command in your terminal to install the package:

    ```
    composer require abdo-taher/laraswagger
    ```
2. **Publish the config file:**

    Publish the configuration file for the package to customize settings:

    ```
    php artisan vendor:publish --tag="config"
    ```

---

### **Usage Instructions:**

[](#usage-instructions)

Once installed, you can generate the Swagger JSON file by running the following Artisan command:

```
php artisan api:docs-json
```

This command will automatically generate the Swagger/OpenAPI JSON file that contains all your API routes and validation rules. You can pass several options to configure the command further:

It looks like you might be referring to the **options** available in the `php artisan api:docs-json` command from the **LaraSwagger** package. Here’s a breakdown of the options you can use when running the command:

It seems like you are presenting the options for the `php artisan api:docs-json` command, and you're looking to verify or format it. The content you've provided looks mostly correct, but I'll format it in a cleaner, more readable way, and ensure it's consistent with typical markdown and table formatting.

Here’s the properly formatted version:

---

### **Options for `php artisan api:docs-json`**

[](#options-for-php-artisan-apidocs-json)

- **`--path`**: This option allows you to specify the location where the Swagger JSON documentation will be saved. The default is `public/api-docs.json`.
- **`--base-url`**: Defines the base URL for all the endpoints documented. If left empty, it defaults to the `app.url` config in Laravel.
- **`--capture-response`**: When set to `true`, the command will attempt to capture real responses for GET requests, which are used to generate example response data in the Swagger documentation. By default, it is enabled.
- **`--timeout`**: Sets how long the command should wait for a response from the API when generating the docs. The default is 15 seconds.
- **`--auth-mode`**: This option defines the authentication method to be used:

    - **`none`**: No authentication is used.
    - **`manual`**: Use a manually provided Bearer token (via `--token`).
    - **`login`**: Automatically logs in via a login endpoint and retrieves a Bearer token.
- **`--token`**: This is only relevant if `--auth-mode=manual` is used. Here, you provide a pre-generated Bearer token for authentication.
- **`--token-type`**: This is the prefix for the token used in Bearer authentication, such as `Bearer` or `JWT`.
- **`--login-url`**: Specifies the URL for the login endpoint when using `--auth-mode=login`. It defaults to `/api/login`.
- **`--login-method`**: Defines the HTTP method (`POST` or `GET`) for the login request.
- **`--login-email` and `--login-password`**: These are the credentials used to log in if `--auth-mode=login` is selected.
- **`--token-key`**: Specifies which key in the response contains the Bearer token when using `--auth-mode=login`. By default, it expects the key to be `token`.
- **`--skip`**: Allows you to specify routes that should be excluded from the generated Swagger documentation. You pass a comma-separated list of route keywords that should be skipped.

---

### **Examples:**

[](#examples)

#### 1. **Basic Example:**

[](#1-basic-example)

Generate the Swagger JSON file using default settings:

```
php artisan api:docs-json
```

This will generate the Swagger documentation and save it to the `public/api-docs.json` file.

#### 2. **Custom Output Path:**

[](#2-custom-output-path)

If you want to specify a custom path for the output JSON file, you can use the `--path` option:

```
php artisan api:docs-json --path=public/swagger/api-docs.json
```

#### 3. **Using Base URL:**

[](#3-using-base-url)

To set a custom base URL for your API documentation:

```
php artisan api:docs-json --base-url=http://127.0.0.1:8000
```

This is useful if your app is running on a different URL or port than the default Laravel environment.

#### 4. **Authentication (Login Mode):**

[](#4-authentication-login-mode)

If your API requires authentication and you want LaraSwagger to automatically log in and use the generated token, you can configure `--auth-mode=login`. Make sure your login endpoint is configured in the `config/laraswagger.php` file.

```
php artisan api:docs-json --auth-mode=login --login-url=/api/login --login-email=docs@local.test --login-password=12345678
```

This will log in using the credentials and capture the token to be used for subsequent requests.

#### 5. **Skip Routes:**

[](#5-skip-routes)

To exclude certain routes from the generated Swagger documentation, use the `--skip` option. You can pass a comma-separated list of route keywords to skip.

```
php artisan api:docs-json --skip=auth,admin
```

This would skip any routes with the keywords `auth` or `admin` in their route names.

---

If you meant something else by "lock for options," let me know, and I’ll clarify further!

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance54

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ef59ce6ae1e830ee6623c7a41efb7ec6b2045be5eebc98df292946ca31217aa?d=identicon)[abdotaher2025](/maintainers/abdotaher2025)

---

Top Contributors

[![abdulrahman-taher2025](https://avatars.githubusercontent.com/u/168735872?v=4)](https://github.com/abdulrahman-taher2025 "abdulrahman-taher2025 (17 commits)")[![abdo-taher](https://avatars.githubusercontent.com/u/56370737?v=4)](https://github.com/abdo-taher "abdo-taher (3 commits)")

### Embed Badge

![Health badge](/badges/abdo-taher-laraswagger/health.svg)

```
[![Health](https://phpackages.com/badges/abdo-taher-laraswagger/health.svg)](https://phpackages.com/packages/abdo-taher-laraswagger)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)

PHPackages © 2026

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