Development Environment Setup - McNamara84/ladis GitHub Wiki

Introduction

This guide provides a step-by-step explanation for installing and setting up the local development environment for LADIS.

Note

We try to make this as easy and thorough as possible but we simply can't cover each and every detail of every tool used in the setup.

Prerequisites

Before you can start developing, you'll need to install several tools. Follow this order for a smooth setup experience:

Git & GitHub โ€“ Version Control (Required)

Git can be installed in various ways. Choose one option based on your comfort level. The Downloads page offers installers for the command-line interface and also GUI applications.

Tip

  • The GitHub Desktop application provides a user-friendly GUI and uses a bundled version of Git, so you don't have to install Git manually.
  • For users comfortable with terminal commands, GitHub CLI provides an efficient way to interact with remote repositories and is a nice companion to git.

Note

On macOS you might need to install the Xcode Command Line Tools. Run xcode-select --install.

PHP (Required)

PHP is the core programming language for this project. As with many tools, the installation procedure differs depending on your OS. For Windows, prebuilt binaries are available. On Unix and macOS you have to rely on your favorite package manager.

Important

The minimum version is PHP 8.2 or higher as per the composer configuration (composer.json).

  1. Download and install PHP
  2. Verify the installation by running php -v in your terminal. You should see a line like this: PHP 8.4.7 (cli) (built: May 6 2025 12:31:58) (NTS)

Tip

Please refer to the PHP Installation and Configuration manual for details.

Node.js (Required)

You must install Node.js before proceeding โ€“ this project requires it for frontend asset compilation and build processes.

Note

This project requires Node.js version 18.0 or higher. Version 22.0 or higher is recommended.

Node.js is a free, open-source, cross-platform JavaScript runtime environment that allows running JS outside the browser. It comes with NPM, a package and dependency manager that will be installed automatically with Node.js.

Installation Steps

  1. Download Node.js: Visit the downloads page and choose an LTS (Long Term Support) version
  2. Install: Follow the installation instructions for your operating system
  3. Verify installation: Open your terminal and run these commands:
    node -v
    npm -v
    You should see version numbers displayed (e.g., v20.11.0 and 10.2.4)

Note

Common Issues:

  • If node or npm commands are not recognized after installation, you may need to restart your terminal or add Node.js to your system PATH
  • On macOS, you might need to restart your terminal or run source ~/.zshrc (or source ~/.bash_profile) after installation

Tip

Advanced users might want to use a Node.js version manager (like nvm, fnm, or volta) for easier version management across multiple projects.

Code Editor/IDE (Required)

Note

Choosing a code editor is a very personal thing for some people and we don't want to tell which one you should use. These are just recommendations to to get contributors started.

We recommend using Visual Studio Code (VS Code or simply VSC). It's available on many platforms, widely adopted, and offers an extensive extension ecosystem.

Tip

If you're camp libre, consider using VSCodium (Codium), a community-driven, freely-licensed binary distribution of VS Code.

IDE Extensions (Highly Recommended)

Extensions can be installed directly from the Extensions view in VSC (โ‡งโŒ˜X) or from the Extensions Marketplace.

Tip

Open VSX is an open-source registry for extensions for VS Code compatible editors. It's the preferred registry for Codium.

Once you have your VSC installed, add these extensions for a better development experience:

EditorConfig Extension

EditorConfig is a plain-text file with simple declarations for maintaining consistent coding styles between different editors and IDEs.

Install the EditorConfig for Visual Studio Code. VSC will adopt the settings from the configuration file, overriding any options in its own settings.

PHP Tools Extension

PHP Tools for Visual Studio Code (PHP Tools) is an extension bundle that provides advanced PHP development features including debugging and IntelliSense. It also integrates support for Composer and Laravel.

Caution

Offers both free and premium (aka paid) features! Stick with the free version.

The bundled extensions are:

The extension provides complete integration of Composer, a dependency manager for PHP, and Packagist, the main Composer repository. The composer executable itself is downloaded automatically.

Tip

Make sure to set COMPOSER_HOME before installation, if you want to keep your user home directory clean.

IntelliPHP offers AI-assisted intelligent code predictions for PHP.

Caution

This is a premium feature. Feel free to disable this extension.

Xdebug profiles contain information about PHP code performance. PHP Profiler enables inspecting of profile files in VSC and it also highlights hot paths in your code.

Warning

XDebug isn't installed automatically.

  • Install and setup XDebug manually
  • or disable this extenison.

Additional Extensions

These aren't required and are general recommendations to make working with common file types more comfortable in VSC:

Initial Installation

Once you have all the prerequisites installed, you can set up the project locally. This process involves cloning the repository and installing the required dependencies.

Step 1: Clone the Repository

First, you need to get a local copy of the project. You can do this using Git from the command line or through a GUI application like GitHub Desktop.

Important

A repository can be cloned using different URLs. Which one you should use depends on your git config.

Using Git Command Line

  1. Open your terminal or command prompt
  2. Navigate to the directory where you want to store the project
  3. Clone the repository:
    # Replace <URL> with the actual URL!
    git clone <URL>
    cd cleanup-laser-database

Using GitHub Desktop

  1. Open GitHub Desktop
  2. Click File โ†’ Clone repository
  3. Enter the repository URL or search for it if you have access
  4. Choose your local path and click Clone

Step 2: Install PHP Dependencies

This project uses Composer to manage PHP dependencies. The composer.json file contains all the required packages for the application to run properly.

  1. Navigate to the project directory in your terminal
  2. Install PHP dependencies:
    composer install

Note

If you installed the PHP Tools extension, Composer should be available automatically. Otherwise, make sure Composer is installed and available in your system PATH.

PHP Tools also exposes Composer commands via the Command Palette. This way it's possible to run Composer commands and scripts even if the executable is not in PATH and thus not available in the terminal.

The installation process will:

  • Download all PHP packages defined in composer.json
  • Create a vendor/ directory with all dependencies
  • Generate the Composer autoloader for efficient class loading

Step 3: Install JavaScript Dependencies

The project uses Node.js and NPM for managing frontend assets and build tools.

Note

Make sure you have completed the Node.js installation from the Prerequisites section before running this command.

In the same project directory, install JavaScript dependencies:

npm install

This command will:

  • Read the package.json file for dependency definitions
  • Download and install all required Node packages
  • Create a node_modules/ directory with the dependencies
  • Generate or update the package-lock.json file for dependency locking

Note

The installation might take a few minutes depending on your internet connection and the number of dependencies.

Step 4: Preparing the Database

Laravel provides first-party support for five different databases.

Tip

By far the simplest method is to use SQLite and we'll assume this database type in this guide. Feel free to choose any other DB if you're comfortable with running your own local DB server.

Create the SQLite database by running this command in the project's root directory:

touch database/database.sqlite

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. Creating the file is all that's necessary.

In the next step we'll update the Laravel environment and configure the database connection.

Step 5: Environment Configuration

Laravel applications use environment files to manage configuration settings that vary between different users and environments (development, staging, production). Per-user settings are store in .env.

Caution

Never commit your .env file to version control as it may contain sensitive information like database credentials and API keys.

  1. Copy the example environment file:

    cp .env.example .env
  2. Open the .env file in your code editor and configure the database connection.

    DB_CONNECTION=sqlite
    DB_DATABASE=database/database.sqlite

E-Mail Configuration

Update the email configuration in your .env file:

MAIL_MAILER=smtp
MAIL_SCHEME=null
MAIL_HOST=MAILSERVERHOST
MAIL_PORT=465
MAIL_USERNAME=MAILSERVERUSERNAME
MAIL_PASSWORD=MAILSERVERPASSWORD
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

Important

Note that MAILSERVERHOST, MAILSERVERUSERNAME and MAILSERVERPASSWORD are placeholders. Replace them with your actual mail server credentials. Depending on the mail server configuration you might also have to update MAIL_PORT and some servers require 2FA.

You can always use MAIL_MAILER=log instead of a real email server. You'll find the messages in storage/logs/laravel.log.

Step 6: Generate Application Key

Laravel requires a unique application key for encryption and security purposes. This key is generated with Artisan, the command line interface included with Laravel.

Generate the application key:

php artisan key:generate

This command will automatically update your .env file with a new APP_KEY value.

Step 7: Database Setup

Before you can use the application, you need to set up the database structure. Again artisan provides a command for that.

Run the database migrations:

php artisan migrate

This will create all the necessary database tables as defined in the project's migration files.

Note

Make sure your database connection is properly configured in the .env file before running migrations.

Start the Development Server

Laravel includes a built-in development server for local testing.

Important

The Laravel server alone is not enough for our setup. Read the whole section to get the full picture.

TL;DR

  1. Run the dev server:
    composer run-script dev
  2. Navigate to http://localhost:8000

Details

The Laravel server is started by running the following command:

php artisan serve

If you navigate to http://localhost:8000 right now, you'll see an error message complaining that the file public/build/manifest.json is missing. This manifest.json is generated by Vite, the frontend build tool used in our project.

In the package.json file you can see that there are two scripts configured for Vite, build and dev:

  1. "build": "vite build": This command will run the build process once.
  2. "dev": "vite": This starts the Vite dev server with hot reloading.

This is a pretty common configuration. Run any of those NPM scripts like this:

npm run <script-name>

Instead of starting the two servers (Laravel and Vite) manually, we'll utilize the scripts defined in composer.json.

The dev command executes a Node.js script called dev-server.js. This script automatically reads the current version tag from Git (when available) and exposes it as an environment variable to the development processes. The script then starts Laravel, the queue worker, and Vite in parallel using concurrently. We use this approach because not all contributors have Git installed via command line (some may only use GitHub Desktop), and the logic was becoming too complex for inline composer scripts.

Start the dev server with hot reloading:

composer run-script dev

You'll see exactly what the command does:

Output of the PROJECTNAME development server

Open your web browser and navigate to http://localhost:8000

Tip

The development server will continue running until you stop it with Ctrl+C in your terminal.

Verification

If everything is set up correctly, this is what you should be able to see without any errors:

The laser app front-page

References

โš ๏ธ **GitHub.com Fallback** โš ๏ธ