A complete multi-tenant SaaS platform for restaurants to manage online ordering, menu, branches, deliveries, and customer interactions.
- β Multi-branch management
- β Dynamic menu builder with modifiers & variants
- β Real-time order tracking
- β Multiple payment gateways (Stripe, PayPal, Cash)
- β Delivery radius & zone management
- β Coupons & promotional offers
- β QR code menu generation
- β Staff & role management (RBAC)
- β Sales reports & analytics
- β Multi-language (English + Arabic)
- β Multi-currency support
- β Browse menu with filters
- β Customizable orders (modifiers, variants)
- β Multiple delivery addresses
- β Order tracking (real-time status)
- β Order history & reordering
- β Favorites list
- β Profile management
- β Tenant (restaurant) management
- β Subscription & billing management
- β Platform-wide analytics
- β Support ticket system
- β Usage monitoring
- Language: PHP 8.2+
- Database: MySQL 8.0+
- Cache: Redis 7.0+
- Queue: Redis-based job queue
- Customer App: HTML5, Bootstrap 5, Vanilla JavaScript
- Admin Panel: HTML5, Bootstrap 5, jQuery/Alpine.js
- UI Framework: Bootstrap 5
- Charts: Chart.js
- Containerization: Docker + Docker Compose
- Web Server: Nginx
- CI/CD: GitHub Actions
- SSL: Let's Encrypt
- Payments: Stripe, PayPal
- Email: SendGrid
- SMS: Twilio
- Maps: Google Maps API
Comprehensive documentation available in /docs:
- System Architecture - Complete architecture overview, technology decisions, scalability strategy
- System Diagrams - Visual architecture, data flows, authentication, deployment
- Database Schema - Complete ERD with 37 tables, SQL migrations, relationships
- Backend Structure - Folder organization, module breakdown, coding standards
- API Documentation - Complete REST API reference with 50+ endpoints
- PHP 8.2 or higher
- MySQL 8.0 or higher
- Redis 7.0 or higher
- Composer
- Node.js & npm (for frontend assets)
- Clone the repository
git clone https://github.com/ahmedsaadawi13/OnlineOrder-PHP.git
cd OnlineOrder-PHP- Install PHP dependencies
composer install- Configure environment
cp .env.example .env
# Edit .env with your database credentials and API keys- Create database
mysql -u root -p
CREATE DATABASE restaurant_saas CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;- Run migrations
php cli.php migrate:run- Seed database (optional)
php cli.php db:seed- Start development server
php -S localhost:8000 -t public- Access the application
- Customer App: http://localhost:8000
- Admin Panel: http://localhost:8000/admin
- Super Admin: http://localhost:8000/superadmin
- Start containers
docker-compose up -d- Install dependencies
docker-compose exec php composer install- Run migrations
docker-compose exec php php cli.php migrate:run- Access application
OnlineOrder-PHP/
βββ config/ # Configuration files
βββ database/ # Migrations & seeds
βββ docs/ # Documentation
βββ public/ # Public web root
βββ src/ # Application source code
β βββ Controllers/ # HTTP controllers
β βββ Models/ # Database models
β βββ Services/ # Business logic
β βββ Middleware/ # HTTP middleware
β βββ Validators/ # Input validation
β βββ Helpers/ # Helper functions
β βββ Jobs/ # Background jobs
β βββ Core/ # Core framework
βββ storage/ # Logs, cache, uploads
βββ tests/ # Automated tests
βββ vendor/ # Composer dependencies
Key environment variables (see .env.example for full list):
# Application
APP_NAME="Restaurant SaaS"
APP_URL=https://yourapp.com
# Database
DB_HOST=localhost
DB_DATABASE=restaurant_saas
DB_USERNAME=root
DB_PASSWORD=
# JWT
JWT_SECRET=your-secret-key
JWT_EXPIRATION=900
# Stripe
STRIPE_PUBLIC_KEY=pk_test_xxx
STRIPE_SECRET_KEY=sk_test_xxx
# SendGrid
SENDGRID_API_KEY=your-api-key
# Twilio
TWILIO_ACCOUNT_SID=xxx
TWILIO_AUTH_TOKEN=xxxRun tests using PHPUnit:
# Run all tests
composer test
# Run with coverage
composer test:coverage
# Run specific test
./vendor/bin/phpunit tests/Feature/OrderTest.php- β JWT authentication with refresh tokens
- β Role-based access control (RBAC)
- β Multi-tenant data isolation
- β SQL injection prevention (PDO prepared statements)
- β XSS protection (output escaping)
- β CSRF protection
- β Rate limiting
- β Password hashing (bcrypt)
- β Audit logging
Base URL: https://api.yourapp.com/api/v1
POST /auth/register- Register restaurantPOST /auth/login- LoginPOST /auth/refresh- Refresh tokenPOST /auth/logout- Logout
GET /restaurants/{id}- Get restaurantPUT /restaurants/{id}- Update restaurantGET /branches- List branchesPOST /branches- Create branch
GET /categories- List categoriesPOST /categories- Create categoryGET /menu-items- List menu itemsPOST /menu-items- Create menu item
GET /orders- List ordersPOST /orders- Create orderGET /orders/{id}- Get order detailsPUT /orders/{id}/status- Update status
See full API documentation - 50+ endpoints documented
- Core architecture
- Database schema
- API documentation
- Backend structure
- Core API implementation
- Authentication system
- Basic frontend
- Admin panel UI
- Customer web app UI
- Payment integration
- Email & SMS notifications
- QR code generation
- Mobile app (React Native)
- Kitchen display system
- Driver management
- Advanced analytics
- Multi-currency support
- Load balancing
- Database sharding
- CDN integration
- Advanced caching
- Microservices migration
- Single server: ~10k orders/day
- Response time: <200ms average
- Database queries: Optimized with indexes
- Caching: Redis-based multi-layer
- Horizontal scaling ready
- Stateless application design
- Session stored in Redis
- Database replication supported
We welcome contributions! Please follow these steps:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
- Follow PSR-12 coding style
- Write PHPUnit tests for new features
- Update documentation
- Add comments for complex logic
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: /docs
- Issues: GitHub Issues
- Email: ahmed.sha3ban13@gmail.com
- Built with PHP 8.2+ and modern best practices
- Inspired by leading food delivery platforms
- Community-driven development
Coming soon
Coming soon
Coming soon
Built with β€οΈ for the restaurant industry