A comprehensive web-based carpooling platform built with PHP following the MVC (Model-View-Controller) architecture. WeDrive connects drivers and passengers for efficient, eco-friendly ride sharing with a focus on user experience and security.
WeDrive is a modern carpooling solution that addresses urban transportation challenges by connecting drivers with available seats to passengers needing rides. The platform promotes sustainable transportation, reduces traffic congestion, and creates a community-driven approach to daily commuting.
- Secure Authentication: Registration, login, and password recovery system
- Profile Management: Comprehensive user profiles with preferences and history
- Verification System: Driver license and identity verification
- Rating System: Mutual rating between drivers and passengers
- Communication Tools: In-app messaging between users
- Ride Publishing: Create detailed ride offers with route information
- Route Planning: Interactive route mapping and optimization
- Passenger Management: Accept/decline ride requests and manage bookings
- Vehicle Management: Add multiple vehicles with specifications
- Earnings Tracking: Monitor ride income and transaction history
- Schedule Management: Set recurring rides and availability
- Advanced Search: Find rides by location, date, time, and preferences
- Real-time Availability: Live updates on ride availability
- Booking System: Easy booking with instant confirmation
- Route Tracking: Real-time ride tracking and notifications
- Payment Integration: Secure payment processing
- Ride History: Complete history of past and upcoming rides
- User Moderation: Admin panel for user management and support
- Content Management: Manage ride listings and user reports
- Analytics Dashboard: Platform usage statistics and insights
- Security Monitoring: Fraud detection and prevention
- Support System: Integrated customer support tools
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Multi-language Support: Internationalization for global reach
- Geolocation Services: GPS integration for accurate location services
- Notification System: Email and SMS notifications for ride updates
- Social Integration: Connect with social media platforms
- Review System: Comprehensive review and feedback mechanism
- PHP 8.0+: Modern PHP with object-oriented programming
- MySQL: Robust relational database management
- MVC Architecture: Clean separation of concerns
- RESTful APIs: Well-structured API endpoints
- JWT Authentication: Secure token-based authentication
- Password Hashing: bcrypt for secure password storage
- HTML5: Semantic markup for accessibility
- CSS3: Modern styling with responsive design
- JavaScript (ES6+): Interactive user interface
- Bootstrap 5: Responsive UI framework
- jQuery: Enhanced DOM manipulation
- AJAX: Asynchronous communication with backend
- Normalized Schema: Efficient database structure
- Indexing: Optimized query performance
- Referential Integrity: Consistent data relationships
- Transaction Support: ACID compliance for data integrity
- Backup Strategy: Regular automated backups
- Input Validation: Server-side and client-side validation
- SQL Injection Prevention: Prepared statements and parameterized queries
- XSS Protection: Output encoding and sanitization
- CSRF Protection: Token-based request verification
- HTTPS Enforcement: Encrypted data transmission
- Session Management: Secure session handling
WeDrive-Carpooling-app/
βββ Controller/ # Application controllers
β βββ UserController.php # User management logic
β βββ RideController.php # Ride management logic
β βββ BookingController.php # Booking system logic
β βββ AuthController.php # Authentication logic
β βββ AdminController.php # Administrative functions
βββ Model/ # Data models and database logic
β βββ User.php # User model and operations
β βββ Ride.php # Ride model and operations
β βββ Booking.php # Booking model and operations
β βββ Vehicle.php # Vehicle model and operations
β βββ Database.php # Database connection and utilities
β βββ Validator.php # Input validation utilities
βββ View/ # User interface templates
β βββ layouts/ # Common layout templates
β βββ auth/ # Authentication views
β βββ dashboard/ # User dashboard views
β βββ rides/ # Ride-related views
β βββ profile/ # User profile views
β βββ admin/ # Administrative interface
βββ .devcontainer/ # Development container configuration
βββ .github/ # GitHub workflows and templates
βββ assets/ # Static assets (CSS, JS, images)
βββ config/ # Configuration files
βββ public/ # Public web directory
βββ .gitignore # Git ignore rules
βββ README.md # Project documentation
- PHP 8.0+ with required extensions:
- PDO (for database connectivity)
- mbstring (for string handling)
- openssl (for encryption)
- json (for JSON processing)
- curl (for external API calls)
- MySQL 8.0+ or MariaDB 10.4+
- Apache 2.4+ or Nginx 1.18+
- Composer for dependency management
- Node.js 16+ and npm for asset compilation
-
Clone the repository
git clone https://github.com/aliammari1/WeDrive-Carpooling-app.git cd WeDrive-Carpooling-app
-
Install PHP dependencies
composer install
-
Install frontend dependencies
npm install
-
Database setup
# Create MySQL database mysql -u root -p CREATE DATABASE wedrive_db; # Import database schema mysql -u root -p wedrive_db < database/schema.sql # Import sample data (optional) mysql -u root -p wedrive_db < database/sample_data.sql
-
Environment configuration
# Copy environment template cp config/.env.example config/.env # Edit configuration file nano config/.env
Configure the following variables:
# Database Configuration DB_HOST=localhost DB_NAME=wedrive_db DB_USER=your_username DB_PASS=your_password # Application Settings APP_URL=http://localhost:8000 APP_ENV=development DEBUG=true # Security Keys JWT_SECRET=your-secret-key ENCRYPTION_KEY=your-encryption-key # Email Configuration SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=[email protected] SMTP_PASS=your-app-password # Google Maps API GOOGLE_MAPS_API_KEY=your-api-key # Payment Gateway (optional) STRIPE_PUBLISHABLE_KEY=pk_test_... STRIPE_SECRET_KEY=sk_test_...
-
Set up web server
Apache (.htaccess):
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [QSA,L]
Nginx configuration:
server { listen 80; server_name wedrive.local; root /path/to/WeDrive-Carpooling-app/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; } }
-
Compile assets
npm run build
-
Set file permissions
chmod -R 755 public/ chmod -R 777 storage/logs/ chmod -R 777 storage/uploads/
-
Start the application
# Using PHP built-in server (development) php -S localhost:8000 -t public/ # Or configure your web server to point to the public/ directory
# Build and run with Docker Compose
docker-compose up -d
# Access the application
open http://localhost:8080
-
Registration & Profile Setup
- Create an account with email verification
- Complete profile with photo and preferences
- Verify phone number for security
-
Finding Rides
- Enter departure and destination locations
- Select date and time preferences
- Filter by price, vehicle type, and driver ratings
- View detailed ride information and driver profiles
-
Booking Process
- Select desired ride from search results
- Choose number of seats required
- Review total cost and booking details
- Confirm booking with payment
-
Managing Bookings
- View upcoming and past rides
- Communicate with drivers
- Modify or cancel bookings (within policy)
- Rate and review completed rides
-
Vehicle Registration
- Add vehicle details and photos
- Upload required documents (license, insurance)
- Complete vehicle verification process
-
Publishing Rides
- Set departure and destination points
- Define route with stops (optional)
- Set date, time, and available seats
- Configure pricing and booking preferences
-
Managing Passengers
- Review and approve booking requests
- Communicate with passengers
- Track earnings and payment status
- Provide ride updates and notifications
-
Profile Management
- Maintain high driver rating
- Update availability and preferences
- Manage vehicle information
- View performance analytics
-
User Management
- Monitor user registrations and activity
- Handle user reports and disputes
- Manage user verification processes
- Implement account restrictions when necessary
-
Platform Monitoring
- Track platform usage and performance
- Monitor payment transactions
- Analyze user behavior and trends
- Generate reports and insights
-
Content Moderation
- Review flagged content and users
- Ensure compliance with platform policies
- Manage ride listings and availability
- Handle customer support tickets
POST /api/auth/register # User registration
POST /api/auth/login # User login
POST /api/auth/logout # User logout
POST /api/auth/forgot-password # Password recovery
POST /api/auth/reset-password # Password reset
POST /api/auth/verify-email # Email verification
GET /api/users/profile # Get user profile
PUT /api/users/profile # Update user profile
GET /api/users/{id} # Get user by ID
DELETE /api/users/{id} # Delete user account
POST /api/users/verify # User verification
GET /api/rides # Search rides
POST /api/rides # Create new ride
GET /api/rides/{id} # Get ride details
PUT /api/rides/{id} # Update ride
DELETE /api/rides/{id} # Cancel ride
GET /api/rides/my-rides # Get user's rides
POST /api/bookings # Create booking
GET /api/bookings # Get user bookings
GET /api/bookings/{id} # Get booking details
PUT /api/bookings/{id} # Update booking
DELETE /api/bookings/{id} # Cancel booking
POST /api/bookings/{id}/rate # Rate completed ride
POST /api/payments/process # Process payment
GET /api/payments/history # Payment history
POST /api/payments/refund # Process refund
GET /api/payments/methods # Get payment methods
# Install testing dependencies
composer install --dev
# Run PHP unit tests
./vendor/bin/phpunit tests/
# Run integration tests
./vendor/bin/phpunit tests/Integration/
# Run frontend tests
npm test
# Generate coverage report
./vendor/bin/phpunit --coverage-html coverage/
- Unit Tests: Individual component testing
- Integration Tests: Database and API testing
- Feature Tests: End-to-end user journey testing
- Security Tests: Authentication and authorization testing
- Performance Tests: Load and stress testing
-
Server Requirements
- Ubuntu 20.04+ or CentOS 8+
- PHP 8.0+ with OPcache enabled
- MySQL 8.0+ or MariaDB 10.4+
- Nginx or Apache with SSL certificate
- Redis for session storage and caching
-
Environment Configuration
# Set production environment APP_ENV=production DEBUG=false # Enable caching CACHE_DRIVER=redis SESSION_DRIVER=redis QUEUE_DRIVER=redis
-
Security Hardening
# Disable server signature # Configure firewall rules # Set up fail2ban for brute force protection # Enable automatic security updates # Configure SSL/TLS certificates
-
Performance Optimization
# Enable OPcache # Configure MySQL query cache # Set up CDN for static assets # Enable gzip compression # Implement database indexing
# .github/workflows/deploy.yml
name: Deploy to Production
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Install dependencies
run: composer install --no-dev --optimize-autoloader
- name: Run tests
run: ./vendor/bin/phpunit
- name: Deploy to server
run: |
rsync -avz --delete . user@server:/var/www/wedrive/
ssh user@server 'cd /var/www/wedrive && php artisan migrate --force'
- GDPR Compliance: User data protection and privacy rights
- Data Encryption: Sensitive data encryption at rest and in transit
- Backup Security: Encrypted backups with access controls
- Audit Logging: Comprehensive security event logging
- Multi-Factor Authentication: Optional 2FA for enhanced security
- Rate Limiting: API and login attempt limitations
- Account Lockout: Automatic lockout after failed attempts
- Session Security: Secure session management and timeout
- Code Reviews: Regular security code reviews
- Vulnerability Scanning: Automated security scanning
- Dependency Updates: Regular security updates
- Penetration Testing: Periodic security assessments
We welcome contributions from the community! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/awesome-feature
- Make your changes
- Follow PSR-12 coding standards
- Add tests for new functionality
- Update documentation as needed
- Run tests and linting
composer test npm run lint
- Commit your changes
git commit -m 'Add awesome feature'
- Push to your branch
git push origin feature/awesome-feature
- Create a Pull Request
- Code Style: Follow PSR-12 PHP coding standards
- Documentation: Update README and inline documentation
- Testing: Maintain test coverage above 80%
- Security: Follow security best practices
- Performance: Consider performance implications
- Accessibility: Ensure accessibility compliance
- π Bug Fixes: Report and fix bugs
- β¨ New Features: Implement new functionality
- π Documentation: Improve documentation
- π¨ UI/UX: Enhance user interface and experience
- π§ Performance: Optimize application performance
- π Localization: Add multi-language support
- π§ͺ Testing: Improve test coverage
- π Security: Enhance security measures
- Page Load Time: < 2 seconds average
- Database Query Time: < 100ms average
- API Response Time: < 500ms average
- Uptime: 99.9% availability target
- User Satisfaction: > 4.5/5 rating goal
- Mobile Application: Native iOS and Android apps
- Real-time Chat: In-app messaging system
- Live Tracking: Real-time ride tracking
- Payment Integration: Multiple payment gateways
- AI Matching: Intelligent ride matching algorithm
- Carbon Footprint: Environmental impact tracking
- Rewards Program: Loyalty points and rewards
- Group Rides: Support for group bookings
- Corporate Accounts: Business account features
- API Marketplace: Third-party integrations
- International Expansion: Multi-country support
- Electric Vehicle Priority: EV-focused features
- Autonomous Vehicle Integration: Self-driving car support
- Blockchain Integration: Decentralized trust system
- IoT Integration: Smart device connectivity
This project is licensed under the MIT License - see the LICENSE file for details.
- β Commercial use allowed
- β Modification allowed
- β Distribution allowed
- β Private use allowed
- β Liability and warranty not provided
- PHP Community: For the robust PHP ecosystem
- MySQL: For reliable database management
- Bootstrap Team: For the responsive UI framework
- jQuery Foundation: For simplified JavaScript development
- Google Maps API: For geolocation services
- Development Team: Core application development
- UI/UX Designers: User interface and experience design
- QA Team: Quality assurance and testing
- Security Experts: Security review and hardening
- Community Contributors: Bug reports and feature suggestions
- Beta Testers: Early adopters who provided valuable feedback
- Open Source Community: For inspiration and best practices
- Academic Advisors: For guidance and project mentorship
- GitHub Issues: Report bugs and request features
- Discussions: Join community discussions
- Wiki: Access detailed documentation
- Project Lead: Ali Ammari - @aliammari1
- Email: Contact for business inquiries
- LinkedIn: Connect with the team
- Twitter: Follow for updates
WeDrive - Connecting people, reducing emissions, building community! πππ
Made with β€οΈ by the WeDrive development team