Skip to content
Laradoc Website

Create Project

New project

Project Creation form

To get started, go to the project creation page and fill your Git repository URL.

Configuration

Before generating your API documentation, Laradoc needs to know some information about your Laravel project.

API Path

Onboarding - API Path

After submitting the creation form, you are invited to specify the base URI for your API. All routes that start with this prefix will be included in the documentation, while routes that do not begin with this prefix will be skipped.

For example, if you set the base URI to api, the following routes would be documented:

  • GET /api/users
  • PUT /api/users/{id}

On the other hand, these routes would be skipped:

  • GET /users
  • PUT /users/{id}

PHP & Database

Onboarding – PHP Version and Database

The second step in the onboarding process is to specify the PHP and database version that your project uses. When documenting your API, Laradoc installs your project in a containerized environment, which requires knowledge of the PHP version and database you are using.

Laradoc supports all PHP versions from 7.4 and the following databases: MySQL 8, PostgreSQL 14, and SQLite.

Please note that the database will only be used to run your tests, so it is important to ensure that the database version matches your phpunit.xml configuration.

Setup Script

Onboarding - Setup Script

To install your project in our ephemeral environment, you can use the default setup script or modify it according to your project needs. The default setup script installs your project dependencies, generates a .env file based on the .env.example, and generates an application key.

Here is the default setup script:

composer install --ansi --no-interaction --no-scripts --no-progress --prefer-dist
cp .env.example .env
php artisan key:generate --force

After the execution of the script, we should be able to successfully run a php artisan route:list command and run the tests php artisan test.

Environment Variables

Onboarding - Environment Variables

Your project is now almost fully configured. The final step is to specify the appropriate environment variables to use while running your tests.

Info

Tests enhance the quality of API documentations generated by Laradoc, which is why they will be run if they are available in your project, even though they are not mandatory.

If you are running your tests against a MySQL database, you can set environment variables that use the following connection information:

Hostname: mysql
Port: 3306
Database: testing
Username: root
Password: password

And if you are using a PostgreSQL database:

Hostname: pgsql
Port: 5432
Database: testing
Username: root
Passowrd: password

Your first build

Once everything is configured, you're invited to choose a Git branch and initiate your first API documentation build.

During a build, Laradoc installs your Laravel project in an ephemeral environment, analyzes your code and runs your tests. This process usually takes a few minutes.

When a build is completed, you can review the output of your setup script, test results, and access your newly generated API documentation.

API Documentation build