Local Development Setup
Set up a complete local development environment for Viax using Laragon, which provides Apache, MySQL, and PHP in a single package.Why Local Development?
Faster Development
Offline Work
Safe Testing
Full Control
Step 1: Install Laragon
Download Laragon
Visit Laragon Website
Download Full Version
Run Installer
- Double-click the installer
- Choose installation directory (default:
C:\laragon) - Complete installation wizard
Start Laragon
Launch Laragon
Start Services
- Apache (port 80)
- MySQL (port 3306)
Verify Services
- 🟢 Apache
- 🟢 MySQL
Test Apache
http://localhostYou should see Laragon welcome pageStep 2: Set Up Backend
Copy Backend Files
- Using PowerShell
- Manual Copy
Verify Backend URL
Open browser and test:Step 3: Set Up Database
Create Database
- HeidiSQL (Recommended)
- phpMyAdmin
- Command Line
Open HeidiSQL
Connect to MySQL
- Host: localhost
- User: root
- Password: (empty by default)
Create Database
- Right-click on connection
- “Create new” > “Database”
- Name:
viax - Collation:
utf8mb4_unicode_ci - Click OK
Import Database Schema
Locate SQL File
basededatos.sqlorbasededatosfinal.sql
Import in HeidiSQL
- Select
viaxdatabase in left panel - File > Load SQL file
- Select your
.sqlfile - Click “Execute” (F9)
- Wait for import to complete
Verify Tables
viax database in HeidiSQL. You should see:- usuarios
- conductores
- solicitudes_servicio
- viajes
- documentos_conductor
- configuracion_precios
- administradores
- audit_logs
- empresas
Configure Database Connection
File:C:\laragon\www\viax\backend\config\database.php
root. Some installations use empty password ''.Step 4: Install PHP Dependencies
Install Composer (if not included)
Laragon usually includes Composer. Verify:- Laragon > Menu > Tools > Quick add > Composer
- Or download from getcomposer.org
Install Backend Dependencies
- PHPMailer (email sending)
- JWT library (future authentication)
- Other PHP dependencies
Step 5: Configure Flutter for Local Backend
For Android Emulator
Android emulator mapslocalhost to 10.0.2.2:
For Physical Android Device
Find Your Local IP
Connect Device to Same WiFi
Run App
For iOS Simulator
iOS Simulator can uselocalhost:
Permanent Configuration (Development)
Edit.vscode/launch.json:
Step 6: Test the Setup
Test Backend Endpoints
- Health Check
- System Verification
- Test Login Endpoint
Test from Flutter App
Run the App
Test Registration
- Open the app
- Tap “Crear cuenta” (Create account)
- Fill in registration form
- Submit
Verify in Database
usuarios table:Development Workflow
Daily Workflow
Start Services
- Open Laragon
- Click “Start All”
- Wait for services to turn green
Start Development
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
Hot Reload
- Press
rin Flutter terminal for hot reload - Press
Rfor hot restart - Press
qto quit
Database Development
View Live Data:Backend Development
Enable Error Display: Add to top of PHP files during development:Troubleshooting
Laragon won't start
Laragon won't start
-
Check if port 80 is in use:
-
Stop conflicting service:
- Skype (uses port 80)
- IIS (Windows web server)
- Other web servers
-
Or change Apache port:
- Laragon > Menu > Apache > httpd.conf
- Change
Listen 80toListen 8080 - Restart Laragon
- Use
http://localhost:8080/viax/backend
Database connection failed
Database connection failed
- Verify MySQL is running (green icon in Laragon)
-
Check credentials:
-
Test connection manually:
-
Check database exists:
404 Not Found on backend URLs
404 Not Found on backend URLs
- Files are in correct location:
- Should be:
C:\laragon\www\viax\backend\ - Not:
C:\laragon\www\backend\
- Should be:
- Verify URL path:
- Correct:
http://localhost/viax/backend/health.php - Wrong:
http://localhost/backend/health.php
- Correct:
- Check file permissions (should auto-set by Laragon)
Composer not found
Composer not found
- Laragon > Menu > Tools > Quick add > Composer
- Restart Laragon
- Verify:
composer --version
Flutter can't connect from emulator
Flutter can't connect from emulator
- Must use
10.0.2.2notlocalhost - Verify with:
- Must be on same WiFi network
- Use computer’s IP (not localhost)
- Disable Windows Firewall temporarily to test
Email sending not working
Email sending not working
Advanced Configuration
Enable PHP Extensions
Edit php.ini
Uncomment Extensions
; from extensions you need:Restart Apache
Virtual Hosts (Optional)
Create a pretty URL likeviax.local:
Create Virtual Host
Update Hosts File
C:\Windows\System32\drivers\etc\hosts (as Administrator):Add:Restart Apache
Test
http://viax.local/health.phpUse in Flutter:Performance Tips
Increase PHP Memory
php.ini:Enable OpCache
php.ini:MySQL Optimization
Disable Xdebug
php.ini: