PHPackages                             styde/enlighten - 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. styde/enlighten

ActiveLibrary[API Development](/categories/api)

styde/enlighten
===============

Enlighten your APIs with auto-generated documentation

0.8(2y ago)57566.0k↓31.8%33[1 issues](https://github.com/StydeNet/enlighten/issues)[2 PRs](https://github.com/StydeNet/enlighten/pulls)MITPHPPHP ^8.2

Since Oct 9Pushed 2y ago14 watchersCompare

[ Source](https://github.com/StydeNet/enlighten)[ Packagist](https://packagist.org/packages/styde/enlighten)[ GitHub Sponsors](https://github.com/sileence)[ Patreon](https://www.patreon.com/duiliopalacios)[ RSS](/packages/styde-enlighten/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (58)Used By (0)

Enlighten for Laravel
=====================

[](#enlighten-for-laravel)

[![](https://github.com/StydeNet/enlighten/workflows/run-tests/badge.svg)](https://github.com/StydeNet/enlighten/workflows/run-tests/badge.svg) [![Latest Stable Version](https://camo.githubusercontent.com/7b60beccf7b8a2396aa34800af6912df6094271509c0954a316ac30324feba27/68747470733a2f2f706f7365722e707567782e6f72672f73747964652f656e6c69676874656e2f76)](//packagist.org/packages/styde/enlighten) [![Total Downloads](https://camo.githubusercontent.com/9b9c0d7a05a9bfb0d5988ca22b846b12d3baa31f7fadd9e97d7da5f23e646495/68747470733a2f2f706f7365722e707567782e6f72672f73747964652f656e6c69676874656e2f646f776e6c6f616473)](//packagist.org/packages/styde/enlighten) [![License](https://camo.githubusercontent.com/607b21d7b05d7ca63191ce41560d16e35a330591e5ea780e6046451a142c7d43/68747470733a2f2f706f7365722e707567782e6f72672f73747964652f656e6c69676874656e2f6c6963656e7365)](//packagist.org/packages/styde/enlighten)

A seamless package to document your Laravel APIs.

There is no need to add endless docblocks to each API method, maintain dozens of readme files, or write extensive wikis to keep your APIs documented and in sync with your codebase!

Enlighten your Laravel applications with a beautiful documentation generated automatically from your test suites, by doing so, your documentation will always be updated with the current version of your app.

If you have already invested a lot of time developing and testing your API you don't need to spend the same amount of time documenting it, we'll do that for you, you deserve it!

Compatibility
-------------

[](#compatibility)

Enlighten is compatible with Laravel 7.28 onwards and requires PHP from version 7.3.

You can be a part of this project:
----------------------------------

[](#you-can-be-a-part-of-this-project)

- [Join us on Discord](https://discord.gg/JyfxmPM)
- [Become a sponsor](https://github.com/sponsors/sileence)
- [Become a contributor](https://github.com/StydeNet/enlighten/blob/main/CONTRIBUTING.md)

Introducing Laravel Enlighten
-----------------------------

[](#introducing-laravel-enlighten)

[![Enlighten preview](./preview.png "Enlighten Dashboard preview")](./preview.png)

After installing the component, run `php artisan enlighten` and that's it! You'll find the entire API documentation in the following URL: `/enlighten/`

Usage
-----

[](#usage)

After finishing the installation process, run your Laravel tests with the following command:

```
php artisan enlighten
```

You can pass any option you'd normally pass to `php artisan test` including the `--parallel` option available in Laravel 8 onwards!

Now visit `/enlighten/` to navigate the documentation.

Run `php artisan enlighten:export` to export the documentation as static files!

Demo project
------------

[](#demo-project)

Follow our 3min installation guide to see Enlighten in action in your own app (you don't need to modify your tests!)

Alternatively, install our [demo project](https://github.com/StydeNet/curso-de-laravel-desde-cero/tree/enlighten) following the instructions in its README.

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

[](#installation)

Installing Enlighten requires only 3 steps!

Step 1: Composer Require
------------------------

[](#step-1-composer-require)

Require the package with Composer as a **dev** dependency:

```
composer require styde/enlighten --dev
```

If you are NOT using the Laravel package auto-discovery feature, please add the following service-provider to `config/app.php`

```
[
    'providers' => [
        // ...
        Styde\Enlighten\Providers\EnlightenServiceProvider::class,
    ]
];
```

Step 2: Install Enlighten
=========================

[](#step-2-install-enlighten)

Run `php artisan enlighten:install` to install and setup Enlighten automatically, otherwise follow the instructions in the [Manual Setup Section](#manual-setup).

Step 3: Database Setup
----------------------

[](#step-3-database-setup)

Create and configure a database for Enlighten following the instructions below:

`Enlighten` needs its own database and database connection to record and preserve the documentation generated from your test suites.

If you use the following convention:

- A non-sqlite default database for your local enviroment (i.e. `my_db`)
- A non-sqlite database for your test enviroment with the `_test` or `_tests` suffix (i.e. `my_db_tests`)

Just add a new database using the same name of your default database with the `_enlighten` suffix, for example:

```
# .env
# If your local database is:
DB_NAME=my_default_database
#
# phpunit.xml
# And your test database is:
#
#
# Then Enlighten will use a third database automatically:
# my_default_database_enlighten

```

If you're not following the convention above, just add a new connection entry in `config/database.php` with the name `enlighten` and your custom configuration:

```
   'enlighten' => [
       'driver' => 'mysql',
       'host' => env('DB_HOST', '127.0.0.1'),
       'port' => env('DB_PORT', '3306'),
       'database' => 'my_enlighten_database',
       // ...
    ],

```

> It's important to have a different connection and a different database for Enlighten in order to avoid having the info deleted or not persisted when using any of the database migration traits included by Laravel or if you run the tests using SQLite.

Use `php artisan enlighten:migrate` to run the package migrations.

You can also use: `php artisan enlighten:migrate:fresh` to refresh the migrations. Warning: this will also delete the auto generated documentation!

Manual Setup
------------

[](#manual-setup)

If you didn't run `php artisan enlighten:install` or you received an error message, you can setup Enlighten manually following these instructions:

Publish the package assets (CSS, JavaScript) to the public folder using Artisan:

```
php artisan vendor:publish --tag=enlighten-build
```

Optionally, you can publish the config file and views for more customization.

```
php artisan vendor:publish --tag=enlighten-config
php artisan vendor:publish --tag=enlighten-views
```

Third step: import the trait `Styde\Enlighten\Tests\EnlightenSetup` and call `$this->setUpEnlighten()` in the `setUp` method of your `TestCase`, for example:

```
