Ulimi is a web-based agricultural marketplace bringing digital transformation to Malawi's farming sector. This repository contains the source code for a platform connecting 2000+ farmers with trusted buyers. Designed for seamless commodity browsing, secure automated transactions, and data transparency to foster trust in local trade.
# Ulimi - Agricultural Marketplace Platform
A PHP-based agricultural marketplace connecting farmers and buyers.
## Recent Updates (April 24, 2026)
### Major Architectural Improvements
**Issues Resolved:**
- **No dependency manager**: Added Composer support for dependency management
- **Mixed storage strategies**: Migrated from file-based user storage to database-backed User model
- **No service container**: Implemented PSR-11 compliant Dependency Injection Container
- **Hardcoded paths**: Replaced hardcoded paths with STORAGE_PATH constant throughout codebase
- **No middleware system**: Implemented complete middleware pipeline with 8 middleware classes
- **No rate limiting**: Implemented RateLimitMiddleware with configurable groups
- **No HTTPS enforcement**: Implemented HttpsMiddleware to enforce HTTPS on all routes
**Statistics:**
- 49 files modified
- 870 lines added, 6,654 lines deleted (net reduction: 5,784 lines)
- Code cleanup and modernization across controllers, views, and core components
### New Features
**Middleware System:**
- AuthenticationMiddleware - User authentication checking
- CsrfMiddleware - CSRF token validation
- HttpsMiddleware - HTTPS enforcement
- RateLimitMiddleware - Rate limiting with configurable groups (auth, api, api-guest, upload, general)
- RoleMiddleware - Role-based access control (admin, seller, buyer)
- Pipeline - Middleware pipeline execution
- AbstractMiddleware & MiddlewareInterface - Base classes and interfaces
**Dependency Injection Container:**
- PSR-11 compliant container with automatic dependency resolution
- Singleton and binding support
- Automatic constructor dependency injection
**Router Enhancements:**
- Fluent middleware registration via RouteBuilder
- Middleware groups for common patterns (auth, admin, seller, buyer)
- Pipeline-based middleware execution
- Container integration for dependency injection
**Database Migration:**
- User model migrated from file-based storage to database
- Automatic slug gene …