The Services layer provides middleware and business logic functionality for the application. Service classes are designed to encapsulate complex operations that span multiple layers of the application architecture.
Service classes are located in dist/backend/libs/MarkdownMaster/Services/.
Service classes handle:
- Middleware operations - Cross-cutting concerns like authentication, logging, caching
- Business logic - Complex operations that don't fit cleanly into Model or Controller layers
- Scheduled tasks - Cron jobs and background processing (see Cron)
Service suffix for service classes (e.g., CronService, AuthService)use MarkdownMaster\Services\CronService;
// Register a cron job
CronService::Register('cleanup_temp', 3600, function() {
// Cleanup logic here
});
// Run due jobs
CronService::RunDue();