No description
  • PHP 93.1%
  • CSS 3.7%
  • JavaScript 3.2%
Find a file
2026-06-17 21:47:34 -04:00
assets feat: attractions toggle on the Map; docs 2026-06-17 21:46:40 -04:00
build build: bundle templates in phar; docs: v1.1 routes + htmx frontend 2026-06-16 18:21:59 -04:00
docs/superpowers docs: real-world overlays implementation plan (5 TDD tasks) 2026-06-17 02:55:48 -04:00
public feat: paths, DI bootstrap, dev front-controller + static serving 2026-06-16 19:49:25 +00:00
src feat: GET /trips/{id}/pois.geojson — attractions near stops 2026-06-17 21:45:34 -04:00
templates feat: attractions toggle on the Map; docs 2026-06-17 21:46:40 -04:00
tests feat: GET /trips/{id}/pois.geojson — attractions near stops 2026-06-17 21:45:34 -04:00
.gitignore feat: Alpine two-column frontend (Layout A) 2026-06-16 19:55:37 +00:00
composer.json chore: scaffold PHP project with composer + phpunit 2026-06-16 19:40:48 +00:00
composer.lock chore: scaffold PHP project with composer + phpunit 2026-06-16 19:40:48 +00:00
config.example.php feat: paths, DI bootstrap, dev front-controller + static serving 2026-06-16 19:49:25 +00:00
phpunit.xml chore: scaffold PHP project with composer + phpunit 2026-06-16 19:40:48 +00:00
README.md feat: attractions toggle on the Map; docs 2026-06-17 21:46:40 -04:00

Road Trip Planner

A single-user US road-trip planner (timing + expenses) packaged as one PHP phar.

Plan an ordered list of stops, set departure date and nights per stop, and watch a day-by-day itinerary and a full expense breakdown (fuel, lodging, food, activities) update live. Driving distances/times and regional fuel prices are looked up automatically (with manual overrides everywhere). Fuel economy is adjusted for terrain — mountainous legs burn ~30% more.

Run

  1. Copy config.example.php → config.php beside trip.phar; add your free EIA and OpenRouteService API keys. (Both optional — without them, enter fuel prices/distances manually.)
  2. php -S localhost:8000 trip.phar
  3. Open http://localhost:8000

Trips and the lookup cache are stored in data/ next to the phar.

Develop

  • composer install
  • vendor/bin/phpunit
  • php -S localhost:8000 public/router.php

Build

  • php -d phar.readonly=0 build/build-phar.php (build with a production autoloader first: composer install --no-dev --optimize-autoloader, then restore dev deps with composer install)

How it works

  • Backend (authoritative): PHP computes all timing and costs. Endpoints under /api/* proxy EIA (fuel) and OpenRouteService/OSRM (routing+elevation) and store trips as JSON. See src/.

  • Frontend: server-rendered PHP templates + htmx (bundled, no build step). Each trip is a bookmarkable URL with tabs:

    • / — dashboard (all trips)
    • /trips/{id} — Stops & costs (default)
    • /trips/{id}/itinerary — day-by-day itinerary
    • /trips/{id}/map — interactive Leaflet map (route polyline + numbered stops), fed by GET /trips/{id}/route.geojson
    • /trips/{id}/budget — budget target with over/under alert + per-person split

    Inline edits debounce a POST /trips/{id}/recompute that autosaves and swaps the summary rail; modals (settings, add/edit stop) load as htmx fragments. Trip ids are opaque 8-char base36 shortcodes, so renaming a trip never changes its URL. The JSON /api/* endpoints remain available.

  • Terrain: each leg is auto-classified flat/rolling/mountainous from its elevation gain (×1.0 / ×0.9 / ×0.7 on MPG); override per leg from a dropdown. Thresholds and multipliers are tunable in config.php.

  • Scheduling: set a max drive hours/day (Settings); legs longer than that split into multiple driving days, adding en-route overnights to the itinerary (food charged at the daily rate; lodging flagged — add an intermediate stop to budget it). Blank = no limit. New trips default to 8h.

  • Round trip: toggle "Round trip" in Settings to add a return leg back to the start (counted in fuel/miles/time and drawn on the map).

  • Export / import: download a trip as JSON from the editor header; import a trip (file or pasted JSON) from the dashboard. Imports always get a fresh id.

  • Reorder: drag the ⠿ handle on a stop card to reorder stops.

  • Weather: the Itinerary tab shows a daily forecast per stop (Open-Meteo, no key) for the dates you're there; lazy-loaded and cached. Beyond ~16 days it shows "forecast unavailable."

  • Attractions: on the Map tab, "Show attractions" overlays nearby tourist POIs (OpenStreetMap via Overpass, no key); cached, off by default.

Spec & plan

  • Design: docs/superpowers/specs/2026-06-16-road-trip-planner-design.md
  • Implementation plan: docs/superpowers/plans/2026-06-16-road-trip-planner.md