PHPackages                             ilovelaravel/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. ilovelaravel/docs

ActiveLibrary[API Development](/categories/api)

ilovelaravel/docs
=================

A tool to generate and display api docs

0357PHP

Since Oct 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ilovelaravel/docs)[ Packagist](https://packagist.org/packages/ilovelaravel/docs)[ RSS](/packages/ilovelaravel-docs/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

API Documentation
=================

[](#api-documentation)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This package contains the documentation generator &amp; documentation viewer. The packaged reads json from a folder and turns it into a website with api info. It also includes a generator.

[![screenshot](https://github.com/ilovelaravel/docs/raw/master/screenshot.png)](https://github.com/ilovelaravel/docs/blob/master/screenshot.png)

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

[](#installation)

`composer require "ilovelaravel/docs":"dev-master"`

Publish config the config

`php artisan vendor:publish`

Usage
-----

[](#usage)

All files needed are stored in `storage/docs`. The main file is `storage/docs/api.json`.

All generated files live in `storage/docs/generated`. Copy them over to `storage/docs` after generation.

You can control where the docs pages are being served from by adding an entry to you `.env` file.

I use this when I am working on the docs: `DOCS_DIRECTORY=storage/docs/generated`..and when I am happy, I change it to: `DOCS_DIRECTORY=storage/docs`

Generator
---------

[](#generator)

Run the following command to generate the files:

`php artisan api:docs:generate `

There you will find the following structure:

```
# Main file which structure we use to create the views
/api.json

# Example request + response objects
/examples
/examples//responses/named.route.json
/examples//requests/named.route.json

# Examples of headers for the requests
/headers

# All the resources(GET,POST,PUT,DELETE) per collection
/resources
/resources/.json
```

### Routes preparation:

[](#routes-preparation)

Routes should look like this:

```
$this->get('users', 'UsersController@index')->name('api.users.index')->middleware('can:users.read');
```

The generator only looks at named routes starting with `api`. Like this: `->name(api.something.something)`The generator can extract permissions from routes that use the `can` middleware.

The frontend views are currently showing a menu, which can be build by preparing the routes like this:

```
# group names turn in to menu items. Below 'general', will be the parent.
# collection will be the name of the child menu name.
$this->group(['group'=>'general','collection'=>'users'],
    function() {
        // ..
    });
$this->group(['group'=>'general','collection'=>'dogs'],
    function() {
        // ..
    });

$this->group(['group'=>'addresses','collection'=>'companies'],
    function() {
        // ..
    });
```

This will result in a menu looking like this:

```
General
    - Users
    - Dogs
Addresses
    - Companies

```

### Controller preparation

[](#controller-preparation)

Annotations should be placed on controller methods.

- `@NoAuth` For methods that do not need `authentication`
- `@Title("Show all users")` A title that describes the api action
- `@Info("This will return all users")` Some information about the action

```
    /**
     * @Title("Show all users")
     * @Info("This will return all users")
     * @return JsonResponse
     */
    public function index(): JsonResponse
    {
        // ..
    }
```

### Form requests preparation

[](#form-requests-preparation)

If you create new form requests, for new api actions, then you could use the artisan command:

`docs:make:request AddUserRequest`

If you update existing form request objects, then you should add the `Guarded` trait and implement the `ApiRequestContract` contract.

Both the `rules()` and the `schema` method should at least return an empty array;

```
// Regular request validation rules. Please always fill this completely,
// also for optional(nullable) fields

public function rules()
{
   return [
       'first_name' => 'required|string'
   ]
}

// This will show up in the documentation. The format is:
// array('parameter key','validation rules','example of expected input')

public function schema()
{
   // Faker can be used to generated example output
   $faker = \Faker\Factory::create();

   return [
       ['first_name','required|string', $faker->firstName], // use faker like this
       ['key','validation','example'], // etc etc
       ['key','validation','example']  // etc
   ]
}
```

### Responses

[](#responses)

The structure of the folder `examples` looks like this::

```
examples/
example/requests/named.route.namespace.json
example/responses/named.route.namespace.json

```

The requests and response files have the same name as your named route. All generated files will be stored in the `docs/generated` folder. This should be your main folder. Configure this in your config. Copy files from there into the main folder. This way you can preview changes in without losing information that is allready generated before.

### Routes command

[](#routes-command)

`php artisan docs:routes` will give you a clean preview of the routes that will be used

[![screenshot](https://github.com/ilovelaravel/docs/raw/master/screenshot2.png)](https://github.com/ilovelaravel/docs/blob/master/screenshot2.png)

### Views

[](#views)

The documentation can be viewed in the browser: `http(s)://your-url.something/docs`

If you like to edit the views, you need to publish them. After publishing the views for the templates can be found at: `resources/views/docs`

I went fast &amp; wonderfull to create this generator. The least important part for me were the views, so they contain a lovely hackjob of inline javascript an some css, which could be refactored, if you care. For me it has absolutely no priority.

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

You can run this command to see that nothing happens. Maybe some errors.

```
composer test
```

Credits
-------

[](#credits)

- [Xander Smalbil](http://videofunk.nl)

License
-------

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/95d527afc0f8384c4737e4755f17d8637b1952eca84750e120592317944b7e99?d=identicon)[ilovelaravel](/maintainers/ilovelaravel)

---

Top Contributors

[![xsmall](https://avatars.githubusercontent.com/u/8101956?v=4)](https://github.com/xsmall "xsmall (17 commits)")

### Embed Badge

![Health badge](/badges/ilovelaravel-docs/health.svg)

```
[![Health](https://phpackages.com/badges/ilovelaravel-docs/health.svg)](https://phpackages.com/packages/ilovelaravel-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)[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.1M454](/packages/google-gax)

PHPackages © 2026

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