PHPackages                             ukfast/laravel-api-docs - 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. ukfast/laravel-api-docs

Abandoned → [ans-group/laravel-api-docs](/?search=ans-group%2Flaravel-api-docs)Library[API Development](/categories/api)

ukfast/laravel-api-docs
=======================

A library for documenting your laravel REST apis

02PHP

Since Jul 4Pushed 3y ago13 watchersCompare

[ Source](https://github.com/ans-group/laravel-api-docs)[ Packagist](https://packagist.org/packages/ukfast/laravel-api-docs)[ RSS](/packages/ukfast-laravel-api-docs/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![UKFast Logo](https://camo.githubusercontent.com/51188f1ebbb9dddb6c0605e7090af67643c3a54f862bd284d6d93e90b2dea20b/68747470733a2f2f696d616765732e756b666173742e636f2e756b2f6c6f676f732f756b666173742f343431783132365f7472616e73706172656e745f73747261706c696e652e706e67)](https://camo.githubusercontent.com/51188f1ebbb9dddb6c0605e7090af67643c3a54f862bd284d6d93e90b2dea20b/68747470733a2f2f696d616765732e756b666173742e636f2e756b2f6c6f676f732f756b666173742f343431783132365f7472616e73706172656e745f73747261706c696e652e706e67)

Laravel API Docs \[Beta\]
=========================

[](#laravel-api-docs-beta)

*Package is still in beta and is not ready for production use*

Automatically generate API documentation for your laravel API's based off your application routes and handy PHP 8 attributes.

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

[](#installation)

First, use composer to require the package as below:

```
composer require ukfast/laravel-api-docs

```

Then all we need to do is to register the service provider in the `providers` key in `config/app.php`:

```
UKFast\LaravelApiDocs\ServiceProvider::class,

```

Usage
-----

[](#usage)

Documentation is generated by scanning your routes file and finding controller methods with special endpoint attributes tagged to them.

Whilst you can easily define your own endpoint types, the package comes with some sensible defaults that generally conform to laravel defaults

### Index

[](#index)

The index endpoint is for endpoints that return a paginated list, for example:

```
use UKFast\LaravelApiDocs\Endpoints;
use App\Http\Resources\PetResource;
use App\Models\Pet;

class PetController
{
    #[Endpoints\Index(PetResource::class)]
    public function index()
    {
        return PetResource::collection(Pet::paginate());
    }
}
```

### Create

[](#create)

The create endpoint is for endpoints that create a new resource.

```
use UKFast\LaravelApiDocs\Endpoints;
use App\Http\Resources\PetResource;
use App\Models\Pet;

class PetController
{
    #[Endpoints\Create(PetResource::class)
    public function store()
    {
    }
}
```

### Show

[](#show)

The show endpoint shows an individual resource

```
use UKFast\LaravelApiDocs\Endpoints;
use App\Http\Resources\PetResource;
use App\Models\Pet;

class PetController
{
    #[Endpoints\Show(PetResource::class)
    public function show()
    {
    }
}
```

### Update

[](#update)

The update endpoint updates a resource

```
use UKFast\LaravelApiDocs\Endpoints;
use App\Http\Resources\PetResource;
use App\Models\Pet;

class PetController
{
    #[Endpoints\Update(PetResource::class)
    public function update()
    {
    }
}
```

### Destroy

[](#destroy)

The destroy endpoint deletes a resource

```
use UKFast\LaravelApiDocs\Endpoints;

class PetController
{
    #[Endpoints\Destroy]
    public function destroy()
    {
    }
}
```

Customising Request and Response Structure
------------------------------------------

[](#customising-request-and-response-structure)

Your API likely has its own format different to the defaults provided by this package. But redefining these is not difficult.

Here's an example of a custom index endpoint:

```
namespace App\Docs;

use UKFast\LaravelApiDocs\Endpoint;
use Attribute;

#[Attribute]
class Index extends Endpoint
{
    public function __construct(protected $resource)
    {}

    public function response()
    {
        return [
            'data' => [$this->ref($this->resource)],
            'meta' => [
                'per_page' => 15,
                'total_pages' => 10,
                'current_page' => 1,
            ],
        ];
    }
}
```

Endpoint classes can define two methods: `request` and `response` each return a PHP array outlining the request structure.

Calls to `$this->ref` can be passed a class path to a any class with the #\[Resource\] attribute on it.

For more examples look inside the `src/Endpoints` folder

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

[](#contributing)

We welcome contributions to this package that will be beneficial to the community.

You can reach out to our open-source team via **** who will get back to you as soon as possible.

Please refer to our [CONTRIBUTING](CONTRIBUTING.md) file for more information.

Security
--------

[](#security)

If you think you have identified a security vulnerability, please contact our team via **** who will get back to you as soon as possible, rather than using the issue tracker.

Licence
-------

[](#licence)

This project is licenced under the MIT Licence (MIT). Please see the [Licence](LICENCE) file for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 92.3% 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/2849e05a522e8ea2cc2a1a86c4373dacd4759608b105bf036acfd9ce38cfacfd?d=identicon)[ukfast](/maintainers/ukfast)

---

Top Contributors

[![Gman98ish](https://avatars.githubusercontent.com/u/7416827?v=4)](https://github.com/Gman98ish "Gman98ish (12 commits)")[![gavtaylor](https://avatars.githubusercontent.com/u/408490?v=4)](https://github.com/gavtaylor "gavtaylor (1 commits)")

---

Tags

apilaravelopenapi3phprest

### Embed Badge

![Health badge](/badges/ukfast-laravel-api-docs/health.svg)

```
[![Health](https://phpackages.com/badges/ukfast-laravel-api-docs/health.svg)](https://phpackages.com/packages/ukfast-laravel-api-docs)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

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

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP wrapper for the Meilisearch API

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

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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