This guide walks you through setting up the project on a local development machine. For production deployment, see the Deployment page.

ℹ️
Before you begin Make sure PHP 8.1+, Composer 2.x, and MySQL 5.7+ are installed on your machine.

Requirements

DependencyVersionNotes
PHP8.1+Required by CI 4.4+
MySQL5.7 / 8.0Primary database
Composer2.xDependency management
Node.js18+ (optional)Only for asset pipeline

Steps

  1. Clone the repository
    terminal bash
    git clone https://github.com/your-org/myapp.git
    cd myapp
  2. Install PHP dependencies
    composer install
  3. Copy the environment file
    cp env .env

    Edit .env with your local database credentials and base URL.

  4. Run migrations and seeders
    php spark migrate
    php spark db:seed MainSeeder
  5. Start the dev server
    php spark serve

    App will be available at http://localhost:8080.

⚠️
Use 127.0.0.1, not localhost MySQL on some setups resolves localhost to a socket path instead of TCP. Use 127.0.0.1 in .env to avoid connection errors.

Configuration

Key variables to configure in .env:

VariableDefaultDescription
CI_ENVIRONMENT required production Set to development locally for detailed error display.
database.default.hostname required MySQL hostname. Use 127.0.0.1.
app.baseURL required Full URL with trailing slash. e.g. http://localhost:8080/
JWT_SECRET optional Only needed if JWT API auth is enabled.
🚫
Never commit .env The file is in .gitignore. Use your CI/CD secrets manager for production values.