- PHP 93.1%
- CSS 3.7%
- JavaScript 3.2%
| assets | ||
| build | ||
| docs/superpowers | ||
| public | ||
| src | ||
| templates | ||
| tests | ||
| .gitignore | ||
| composer.json | ||
| composer.lock | ||
| config.example.php | ||
| phpunit.xml | ||
| README.md | ||
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
- Copy
config.example.php→config.phpbesidetrip.phar; add your free EIA and OpenRouteService API keys. (Both optional — without them, enter fuel prices/distances manually.) php -S localhost:8000 trip.phar- Open http://localhost:8000
Trips and the lookup cache are stored in data/ next to the phar.
Develop
composer installvendor/bin/phpunitphp -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 withcomposer 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. Seesrc/. -
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 byGET /trips/{id}/route.geojson/trips/{id}/budget— budget target with over/under alert + per-person split
Inline edits debounce a
POST /trips/{id}/recomputethat 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