Installation Guide

Installation Methods

There are two primary ways to install the Forge framework:

1. Using the Installer Script (Recommended)

The easiest way to install Forge is using the installer script, which takes care of everything for you:

bash <(curl -Ls https://raw.githubusercontent.com/forge-engine/installer/refs/heads/main/installer.sh)

Note: Windows support for the installer script is currently in development.

2. Manual Installation

You can also start with a blank project:

  1. Clone the starter repository:
    git clone https://github.com/forge-engine/forge-starter
  2. Navigate to the project directory:
    cd forge-starter
  3. Run the installation command:
    php forge.php install:project

This will set up your project, install required modules, generate an app key, and create the .env file.

Module Installation

The base installation is very lightweight (less than 500KB) and comes with essential modules. You can add or remove modules as needed.

Default Modules

The framework comes with these core modules:

  • forge-package-manager - Manages package dependencies
  • forge-router - Handles routing
  • forge-view-engine - Template rendering
  • forge-error-handler - Error handling and reporting

Installing Additional Modules

You can install modules in two ways:

1. Using the CLI Command

php forge.php install:module module-name@version

The version parameter is optional. If omitted, the latest version will be installed.

2. Manual Installation

You can manually download modules from the GitHub repository and place them in your /modules/ directory:

https://github.com/forge-engine/modules

Framework Structure

Directory Structure

Core Directories

  • /apps - Application code
  • /engine - Framework core
  • /modules - Installed modules
  • /public - Public assets
  • /storage - File storage
  • /cache - Cached files

App Structure

  • MyApp.php - App bootstrap
  • Controllers/ - Controllers
  • config/ - Configuration
  • routes/ - Route definitions
  • resources/ - Views & assets

Configuration Files

Key configuration files in your project:

  • forge.json - Framework configuration
  • forge-lock.json - Package dependencies
  • apps.php - Application definitions
  • .env - Environment variables