Skip to main content

Local Development Setup

Set up a complete local development environment for Viax using Laragon, which provides Apache, MySQL, and PHP in a single package.
This guide focuses on Windows with Laragon. For macOS/Linux, use MAMP, XAMPP, or manual Apache/MySQL setup.

Why Local Development?

Faster Development

No network latency, instant response times for API calls

Offline Work

Develop without internet connection

Safe Testing

Test destructive operations without affecting production data

Full Control

Complete access to database, logs, and server configuration

Step 1: Install Laragon

Download Laragon

1

Visit Laragon Website

2

Download Full Version

Download Laragon Full (includes Apache, MySQL, PHP, Redis, Memcached)File size: ~150 MB
3

Run Installer

  • Double-click the installer
  • Choose installation directory (default: C:\laragon)
  • Complete installation wizard

Start Laragon

1

Launch Laragon

Open Laragon from Start Menu or desktop shortcut
2

Start Services

Click “Start All” button (bottom-left)Services that will start:
  • Apache (port 80)
  • MySQL (port 3306)
3

Verify Services

Check that icons turn green:
  • 🟢 Apache
  • 🟢 MySQL
4

Test Apache

Open browser and visit: http://localhostYou should see Laragon welcome page

Step 2: Set Up Backend

Copy Backend Files

Verify Backend URL

Open browser and test:
Expected response:

Step 3: Set Up Database

Create Database

Import Database Schema

1

Locate SQL File

Find the database file in your Viax project:
  • basededatos.sql or
  • basededatosfinal.sql
2

Import in HeidiSQL

  1. Select viax database in left panel
  2. File > Load SQL file
  3. Select your .sql file
  4. Click “Execute” (F9)
  5. Wait for import to complete
3

Verify Tables

Expand viax database in HeidiSQL. You should see:
  • usuarios
  • conductores
  • solicitudes_servicio
  • viajes
  • documentos_conductor
  • configuracion_precios
  • administradores
  • audit_logs
  • empresas
Alternative: Import via Command Line

Configure Database Connection

File: C:\laragon\www\viax\backend\config\database.php
Laragon’s default MySQL password is root. Some installations use empty password ''.

Step 4: Install PHP Dependencies

Install Composer (if not included)

Laragon usually includes Composer. Verify:
If not installed:
  1. Laragon > Menu > Tools > Quick add > Composer
  2. Or download from getcomposer.org

Install Backend Dependencies

Installed packages:
  • PHPMailer (email sending)
  • JWT library (future authentication)
  • Other PHP dependencies

Step 5: Configure Flutter for Local Backend

For Android Emulator

Android emulator maps localhost to 10.0.2.2:

For Physical Android Device

1

Find Your Local IP

2

Connect Device to Same WiFi

Ensure your phone is on the same network as your computer
3

Run App

For iOS Simulator

iOS Simulator can use localhost:

Permanent Configuration (Development)

Edit .vscode/launch.json:

Step 6: Test the Setup

Test Backend Endpoints

Expected:

Test from Flutter App

1

Run the App

2

Test Registration

  1. Open the app
  2. Tap “Crear cuenta” (Create account)
  3. Fill in registration form
  4. Submit
3

Verify in Database

Open HeidiSQL and check usuarios table:
You should see the new user you just created.

Development Workflow

Daily Workflow

1

Start Services

  1. Open Laragon
  2. Click “Start All”
  3. Wait for services to turn green
2

Start Development

3

Monitor Logs

  • Flutter logs: In terminal where app is running
  • Backend logs: C:\laragon\www\viax\backend\logs\
  • Apache logs: C:\laragon\bin\apache\apache-X.X.X\logs\
  • MySQL logs: Laragon > Menu > MySQL > Log file
4

Hot Reload

  • Press r in Flutter terminal for hot reload
  • Press R for hot restart
  • Press q to quit

Database Development

View Live Data:
Reset Test Data:

Backend Development

Enable Error Display: Add to top of PHP files during development:
Logging:

Troubleshooting

Port conflicts:
  1. Check if port 80 is in use:
  2. Stop conflicting service:
    • Skype (uses port 80)
    • IIS (Windows web server)
    • Other web servers
  3. Or change Apache port:
    • Laragon > Menu > Apache > httpd.conf
    • Change Listen 80 to Listen 8080
    • Restart Laragon
    • Use http://localhost:8080/viax/backend
Solutions:
  1. Verify MySQL is running (green icon in Laragon)
  2. Check credentials:
  3. Test connection manually:
  4. Check database exists:
Check:
  1. Files are in correct location:
    • Should be: C:\laragon\www\viax\backend\
    • Not: C:\laragon\www\backend\
  2. Verify URL path:
    • Correct: http://localhost/viax/backend/health.php
    • Wrong: http://localhost/backend/health.php
  3. Check file permissions (should auto-set by Laragon)
Install Composer:
  1. Laragon > Menu > Tools > Quick add > Composer
  2. Restart Laragon
  3. Verify: composer --version
Or download from getcomposer.org
Android Emulator:
  • Must use 10.0.2.2 not localhost
  • Verify with:
Physical Device:
  • Must be on same WiFi network
  • Use computer’s IP (not localhost)
  • Disable Windows Firewall temporarily to test
PHPMailer Configuration:For local development, configure SMTP in backend:
Or use Mailtrap.io for testing emails.

Advanced Configuration

Enable PHP Extensions

1

Edit php.ini

Laragon > Menu > PHP > php.ini
2

Uncomment Extensions

Remove ; from extensions you need:
3

Restart Apache

Laragon > Stop All > Start All

Virtual Hosts (Optional)

Create a pretty URL like viax.local:
1

Create Virtual Host

Laragon > Menu > Apache > sites-enabled > AddContent:
2

Update Hosts File

Edit C:\Windows\System32\drivers\etc\hosts (as Administrator):Add:
3

Restart Apache

Laragon > Stop All > Start All
4

Test

Visit: http://viax.local/health.phpUse in Flutter:

Performance Tips

Increase PHP Memory

In php.ini:

Enable OpCache

In php.ini:

MySQL Optimization

In HeidiSQL, run:

Disable Xdebug

Comment out in php.ini:

Useful Laragon Commands

Local Development Ready! You now have a complete local environment for Viax development with hot reload, database access, and full debugging capabilities.