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.β







