PHPackages                             abdumannon/swagger - 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. abdumannon/swagger

ActiveLibrary[API Development](/categories/api)

abdumannon/swagger
==================

This package helps to debug your code and making API documantation

0.0.7(1y ago)29PHP

Since Feb 28Pushed 1y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (8)Used By (0)

### If there is any question or issue, please contact with [developer](https://t.me/abd_ceo).

[](#if-there-is-any-question-or-issue-please-contact-with-developer)

Installation
============

[](#installation)

```
composer require abdphyr/swagger
```

```
php artisan vendor:publish --provider="Abdphyr\Swagger\SwaggerServiceProvider"
```

Publish command copies "swagger.php" to config folder. This file contains multiple page configurations.

```
// pages
return [
    'default' => [
        ...,
        'document' => [...] // This properties matches fully `OPEN API`s configuration.
    ],
    'admin' => [...],
    'otherpage' => [...]
];
```

Request class
-------------

[](#request-class)

```
namespace App\Http\Requests;

use Abdphyr\Swagger\Attributes\DTO\FileParam;
use Abdphyr\Swagger\Attributes\DTO\RequestParam;
use Illuminate\Http\UploadedFile;

#[RequestParam(key: 'name', value: 'Rich dad and poor dad')]
#[RequestParam(key: 'year', value: '1997')]
#[RequestParam(key: 'series', value: 'DWAR')]
#[FileParam(key: 'file', value: new UploadedFile('path/to/file'))]
class BookUpsertRequest extends BaseRequest
{
    public function rules(): array
    {
        return [
            'name' => ['required', 'string'],
            'year' => ['required', 'string'],
            'series' => ['required', 'string'],
            'file' => ['nullable']
        ];
    }
}
```

Controller
----------

[](#controller)

```
namespace App\Http\Controllers;

use Abdphyr\Swagger\Attributes\Http\ActionMethod;
use Abdphyr\Swagger\Attributes\Http\ActionController;
use App\Services\BookService;

// Absolute path: http://localhost:8000/api/book
// This controller API data visible `default` page
#[ActionController(uri: 'book', pages: ['defaut'])]
class BookController extends Controller
{
    public function __construct(protected BookService $service) {}

    // Path: http://localhost:8000/api/book?name=Rich...
    // "auth: false" means this endpoint don't require authentication.
    // "query: ['name' => 'Rich..']" for query params
    #[ActionMethod(uri: '', method: 'GET', query: ['name' => 'Rich..'], auth: false)]
    public function index()
    {
        return $this->service->index();
    }

    // Path: http://localhost:8000/api/book/{id}
    // This API on both `default` and `admin` pages because of "pages: ['admin']"
    #[ActionMethod(uri: '{id}', method: 'GET', route: ['id' => 1], pages: ['admin'])]
    public function show($id)
    {
        return $this->service->show($id);
    }

    // Path: http://localhost:8000/api/book
    #[ActionMethod(uri: '', method: 'POST', summary: 'Creating Book')]
    public function store(BookUpsertRequest $request)
    {
        return $this->service->create($request->validated());
    }

    // Path: http://localhost:8000/api/book-top-all
    // Absolute path is not used beacuse of `uri` starting with `/` that marks this `uri` is `ABSOLUTE PATH`
    #[ActionMethod(uri: '/book-top-all', method: 'GET', , summary: 'Top books')]
    public function topBooks()
    {
        return $this->service->topBooks();
    }
}
```

We can generate API document for each "page" respectively. For example:
-----------------------------------------------------------------------

[](#we-can-generate-api-document-for-each-page-respectively-for-example)

```
php artisan generate:swagger default
```

If we want to generate API document page's certain controller:
-----------------------------------------------------------------------------

[](#if-we-want-to-generate-api-document-pages-certain-controller)

```
php artisan generate:swagger default --c=ExampleController
php artisan generate:swagger default --controller=ExampleController
```

If we want to generate API document page's certain controller's action:
--------------------------------------------------------------------------------------

[](#if-we-want-to-generate-api-document-pages-certain-controllers-action)

```
php artisan generate:swagger default --c=ExampleController --method=show
php artisan generate:swagger default --controller=ExampleController --m=show
```

If we want to remove API document page's certain \[controler\] or controller's action:
--------------------------------------------------------------------------------------------------------------------

[](#if-we-want-to-remove-api-document-pages-certain-controler-or-controllers-action)

```
php artisan generate:swagger default --rm --c=ExampleController
php artisan generate:swagger default --rm --controller=ExampleController --m=show
```

If we want to clear page document:
-------------------------------------------------

[](#if-we-want-to-clear-page-document)

```
php artisan generate:swagger default --clear
```

Config key and page and url matches.
=================================================================================

[](#config-key-and-page-and-url-matches)

#### Config

[](#config)

```
// config/swagger.php
return [
    // page name
    'default' => [...]
];

// PAGE NAME: `default`
// COMMAND: php artisan generate:swagger `default`
// UI: http://localhost:8000/swagger/default-ui
// DATA: http://localhost:8000/swagger/default-data
```

[UI](http://localhost:8000/swagger/default-ui)
==============================================

[](#ui)

[DATA](http://localhost:8000/swagger/default-data)
==================================================

[](#data)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance48

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

7

Last Release

408d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3498398f46a8c7cb3a45088e49837806495f459e0d33fcdc3664adc1f23f08a0?d=identicon)[abdphyr](/maintainers/abdphyr)

---

Top Contributors

[![abdphyr](https://avatars.githubusercontent.com/u/92175578?v=4)](https://github.com/abdphyr "abdphyr (8 commits)")

### Embed Badge

![Health badge](/badges/abdumannon-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/abdumannon-swagger/health.svg)](https://phpackages.com/packages/abdumannon-swagger)
```

###  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.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

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