This is a real-time fleet tracking and geofencing system built with PHP, Firebase, MySQL, and Google Maps. The system allows administrators to monitor hundreds of trucks simultaneously, view truck details, draw and manage geofences, and log vehicle entries into those geofenced zones.
- 🔴 Live Tracking: Real-time truck locations updated automatically on Google Maps
- 📌 Geofence Drawing Tool: Draw circular or polygonal geofences using a simple UI
- 🧭 Geofence Entry Logging: Automatically logs when a vehicle enters a geofence, with timestamp, geofence name, and truck ID
- 📋 Truck Info Dashboard: Lists all registered trucks with their latest GPS and status info
- 📍 Geofence Viewer: View all saved geofences on a map
- 🔄 Data Sources: Supports GPS data collection from IoT devices or smartphone apps
- 💾 Database: Uses Firebase for real-time updates and MySQL for persistent logging
.
├── firebaseRDB.php # Firebase Realtime Database PHP handler
├── index.php # Dashboard showing all trucks with live data
├── live_location_of_trucks.php # Live location map view for individual truck
├── map_form.php # Draw and save new geofences
├── showPoly.php # View all existing geofences on map
├── vehicles_geofence_log.php # Logs of vehicle entries into geofenced areas
- Frontend: HTML, CSS, Bootstrap, JavaScript, Google Maps API
- Backend: PHP
- Database:
- Firebase Realtime DB (for live data)
- MySQL (for logs and storing data)
- Other: AJAX, jQuery, Cron Jobs (optional for syncing)
Supports two modes:
- IoT GPS Devices sending live GPS data
- Smartphones with location tracking apps running in the background
- Firebase: For real-time syncing and monitoring
- MySQL: For long-term historical analysis and reporting
This system can benefit various industries and sectors, including:
- ⛽ Logistics & Transportation – For managing and monitoring fleets, deliveries, and shipments
✈️ Aviation Ground Services – To track movement of service vehicles within airport premises- ⛴️ Mining & Construction – To monitor on-site equipment and ensure safety within predefined zones
- 🌳 Forestry & Agriculture – For managing movement of equipment or transport trucks in large, remote areas
- 🏛️ Municipal & Utility Services – For tracking garbage collection, maintenance vehicles, or emergency services
- 🚑 Healthcare (Ambulance Fleet) – To track ambulances in real-time and log hospital zone entries
- 🚨 Security & Law Enforcement – Monitor patrol routes and enforce zone-specific movement
- 🏢 Real Estate & Facility Management – Manage on-site vehicle access for residential or industrial complexes
- Drivers or IoT devices send GPS coordinates to Firebase
index.phpfetches live data from Firebase and displays all trucks- Admins draw geofences using
map_form.phpand save them to the DB showPoly.phprenders all saved geofences on a maptrack.phpshows each truck's live location on a separate map- When a truck enters a geofence,
vehicles.phplogs it with:- 📌 Truck name, registration ID
- 🧭 Geofence name
- 📅 Date & Time
- Clone this repository:
git clone https://github.com/your-username/fleet-geofence-tracker.git
cd fleet-geofence-tracker- Add your Firebase URL to
firebaseRDB.php:
$firebase = new firebaseRDB("https://your-project.firebaseio.com/");-
Configure your Google Maps API key in relevant files (e.g.,
live_location_of_trucks.php,map_form.php) -
Deploy on your local server or live server with PHP 7+
This project is licensed under the MIT License.
M. H. A. Afif
Founder & Lead Engineer – SystemSage Solutions
🔗 LinkedIn
🔗 Portfolio Website
“Real-time fleet intelligence for smarter, safer, and more sustainable logistics.”







