PHP Luminova: Framework Components and API Reference
Throttler class offers a simple and efficient way to control request frequency, helping you prevent abuse and regulate access across your application.
Welcome to the Luminova Components and API Reference, a detailed guide to the classes, functions, variables, and constants within the Luminova core libraries and modules.
Core Components
Autoload
- General Bootstrap: Initializes the framework with essential environment setup and core autoloaders for all application contexts.
- HTTP Bootstrap: Entry point for handling web (HTTP) requests and initializing HTTP-specific services.
- CLI Bootstrap: Initializes the framework for command-line interface (CLI) usage, loading only CLI-relevant components.
- Modules Factory: Use factories to manage module creation and dependencies in a modular application architecture.
- Custom Modules Service: Define and manage custom services within the application, facilitating easy module integration.
Core Application
- Abstract Application: Base application class providing lifecycle methods, context handling, and core bindings.
- Abstract Functions: Core helper functions for global utilities used throughout the framework.
- Abstract Database Backup Connections: Class for managing automated database connection fallbacks.
- Abstract Service Loader: Service container logic for managing and injecting dependencies across the application.
- Abstract Cronjob Tasks: Scheduler foundation for defining and executing recurring tasks.
Configuration
- AI Models Configurations: Define settings for AI model providers, access tokens, and default model behavior.
- API Requests Configurations: Set request handling rules, allowed headers, API restrictions and more.
- Browser Requests Configurations: Configure headers, user-agent detection, and browser-specific behaviors.
- Client-Side Cookie Configurations: Manage how cookies are sent, stored, and secured on the client side.
- Cronjob Tasks Configurations: Define scheduled task intervals, execution rules, and handlers.
- CSP Configurations: Set up Content Security Policies for controlling allowed sources and scripts.
- Cryptography Configuration: Manage encryption driver, hashing algorithms, and cryptographic behaviors.
- Filesystem Configurations: Configure file storage paths, permissions, and access rules.
- IP Address Configurations: Control trusted IPs, blacklist/whitelist settings, and proxy detection API.
- Mailer Configurations: Set email transport methods, SMTP credentials, and message defaults.
- Autoload Modules: Register and enable modules and name alias that should be loaded at runtime.
- Logger Configurations: Define log handler, auto-backup limit, default email template, and more.
- Backend Session Configurations: Handle session cookies, storage backends, and expiry rules.
- Request Security Configurations: Apply validation rules, CSRF protection, and request filters.
- Database Fallback Configurations: Set up credentials fallback database connection if default fails.
- Service Registry Configurations: Configure service modules and their initialization rules.
- Sitemap Generator Configurations: Set generation frequency, default URLs, and robot directives.
- SCO Schema Configurations: Define structured data (schema.org) templates and customization settings.
- Cloud Storages Configurations: Set credentials and settings for S3, Azure, or other cloud storage providers.
- Template Rendering Configurations: Manage view rendering engines, paths, and caching behavior.
Variables, Global Functions and Constants
- Environment Variables: Defines runtime environment variables for controlling app behavior and deployment modes.
- Constants Variables: Lists built-in framework constants used for system configuration and logic branching.
- Global Procedural Functions: Collection of helper functions accessible globally across the application.
Routing
- System Routing: Describes the default URL routing engine and how it maps requests to handlers.
- Method Route Attribute: Attach specific route paths directly to controller methods using attributes.
- Class Prefix Route Attribute: Limit a shared URI prefix for all routes within a controller class.
- Class Error Route Attribute: Set a custom error handler for route-specific
404
at the class level. - Routing Placeholder Patterns: Customize route parameters using defined pattern-based placeholders.
- Route Method-Based URI Prefixing: Use methods to programmatically define URI limit prefixes.
- URI Segment Util: Utility for accessing parsed URI segments, paths, and base URLs.
- Routing Method Dependency Injection: Inject dependencies directly into route method parameters.
- Routing Examples: Practical routing examples for common use cases and advanced routing scenarios.
Controllers
- Abstract Base HTTP Controller: Core controller class for handling web (HTTP) requests with routing and response tools.
- Abstract Base CLI Controller: Base class for CLI commands, providing argument parsing and execution structure.
- Abstract Base Database Model: Defines database interaction logic, including query building and model behavior.
- Abstract Base Configuration: Allows access and manipulation of configuration data in a structured way.
- Abstract Base Email Template: Base class for generating and sending templated emails using configured transports.
- Abstract Base Session Handler: Custom session management class for handling backend session storage and behavior.
Templating
- View Rendering: Manage rendering of view files and passing of data to templates.
- Response Handling: Encapsulate view output, content types, and status codes in response objects.
- Core PHP Template: Use native PHP for layout rendering with basic inheritance and sectioning.
- Smarty Template: Integrate and use the Smarty templating engine for layout features.
- Twig Template: Render templates using the Twig engine with logic separation.
- Template Examples: Examples showcasing how to structure and render views with different engines.
Data Management
Database
- Database Drivers: Overview of supported database engines like MySQL, SQLite, SQL Server, and Oracle.
- Database Connection: Class for establishing and managing database connections.
- Database Builder ORM: Fluent ORM for building and executing SQL queries.
- Database Backup and Export: Tools for exporting and backing up databases.
- Database Migration: Define and run versioned schema changes with
up/down
methods. - Database Seeding: Seed your database with initial or test data for development and testing.
- Database Schema (Blueprint): Blueprint system for defining and modifying table structures.
- Database Version Control: Track and manage database versioning and change history.
- Database Examples: Practical usage examples for queries, models, migrations, and more.
Caching
- Filesystem Cache: Store cache data on disk for persistence across requests.
- Memory Cache: Use in-memory storage (e.g., Memcached) for fast, volatile caching.
- PSR Cache Pool: PSR-6 compatible cache pool for flexible and interoperable caching.
- PSR Simple Cache: PSR-16 simple cache interface for lightweight, standardized caching.
- Static View Content: Cache rendered views and content fragments to reduce rendering time.
- Cache Examples: Example scenarios for using different caching strategies effectively.
Storage and Filesystem Management
- Cloud Storages: Manage cloud-based storage providers like S3 and Azure Blob.
- File Management Helpers: Utilities for handling files, paths, permissions, and metadata.
- Private File Delivery: Secure delivery of private or protected files using File Delivery Manager (FDM).
- File Uploader: Handle secure and efficient file uploads with validation and destination rules.
- PSR Data Stream: Stream data using PSR-7/PSR-17 compliant interfaces for file and network IO.
Web & HTTP
Incoming HTTP Requests
- Incoming Request: Handles and parses incoming HTTP request data including methods, inputs, and URI.
- File Upload Object: Encapsulates uploaded files, including validation, size, and MIME type handling.
- Request Headers: Access and manage HTTP headers sent with client requests.
- Request User-Agent: Extract and analyze the client's browser or device user-agent string.
- Server Properties: Read server-level information like host, port, protocol, and environment.
- HTTP Status Codes: Reference for standard HTTP status codes used across requests and responses.
- PSR URIInterface Class: PSR-7 compliant URI class for parsing and manipulating request URIs.
Outgoing Network Request
- Outgoing Request: Make HTTP requests to external APIs or services with customizable options.
- Request Clients: Reusable client class for handling external API calls (e.g,
Curl
,Guzzle
). - Request Client Config Options: Configuration options for fine-tuning outgoing request behavior.
- PSR Response Message: Class representing HTTP responses from remote servers, with status, headers, and body.
Cookies and Sessions
- Client-Side Cookie Class: Create and manage client-side cookies with options for security and expiration.
- Client Cookie Examples: Real-world examples of how to use and structure cookie data.
- Cookie File Jar: Store cookies persistently in a file-based "jar" across HTTP requests.
- Backend Session Class: Handle server-side session management with advanced control.
- Database Session Handler: Store session data securely in a database backend.
- Filesystem Session Handler: Persist sessions to the filesystem with configurable paths.
- Backend Session Examples: Practical examples demonstrating backend session operations and configurations.
Security and Encryption
- CSRF Protection: Prevent cross-site request forgery attacks by generating and validating CSRF tokens.
- TOTP Authenticator: Time-based One-Time Password (TOTP) system for two-factor authentication.
- TOTP Google Client: Google authenticator client integration for verifying and submitting TOTP codes.
- Input Validation (Rule-Based): Rule-based system for validating incoming data with custom rules.
- JWT Authentication: Secure user authentication using JSON Web Tokens with expiration and claim support.
- Rate Limiter: Throttle incoming requests to protect endpoints from abuse and overload.
- Security Examples: Code examples demonstrating various security features and use cases.
- Crypter Integration: Simple encryption/decryption layer for strings and sensitive data.
- Encryption Drivers: Driver-based encryption using OpenSSL, Sodium, or custom implementations.
- Encryption Examples: Sample usage of cryptographic functions for secure data handling.
Languages
- Translation Integration: Manage and load multilingual content using key-based language files.
SEO Optimization
- Schema Object Integration: Enhance webpage SEO with structured data using schema.org vocabulary.
- Sitemap Generator: Automatically generate XML sitemaps to improve site indexing and discoverability.
- SEO Examples: Sample implementations for structured data, meta tags, and sitemaps.
Utilities & Helpers
Utility Classes
- Event Emitter: Manage and dispatch custom events with observers for asynchronous or synchronous operations.
- Async & Task Queue: Handle asynchronous tasks in a queued system for better flow control and prioritization.
- Fiber Async & Await: Leverage PHP fibers for async programming with
await
andasync
feature. - Promise Object: Work with promises for deferred execution and handling asynchronous results.
- Pipeline Chain Execution: Chain a series of operations or tasks into a single flow for cleaner code.
- Async Timeout Intervals: Schedule and manage timed asynchronous operations with delay and interval handling.
- Command Process Executor: Execute and manage system commands or processes.
- Array Util: Helper functions for common array operations like filtering, mapping, and merging.
- Lazy Load Object: Implement lazy-loaded objects that only initialize when accessed, improving performance.
- String Listify: Manipulating strings for searching, storing or converting to array.
- IP Address: Utilities for handling IP addresses, including validation and conversion.
- Basic Math: Simple mathematical functions such as addition, subtraction, and rounding.
- Basic Helper Methods: A collection of basic utility functions for common operations.
- Input Escaper: Safely escape user inputs to prevent injection attacks and ensure proper encoding.
- SMTP & Email Template: Handle SMTP connections and email template rendering for sending emails.
- OpenAI Model Integration: Integrate OpenAI's models for natural language processing tasks.
- AI Model Helper: Utilities to facilitate the integration and usage of custom AI models.
Date and Time
- Date & Time Immutable: Immutable date and time object with full support for time zone manipulation and formatting.
- Time-Based Tasks: Utilities for checking time-based tasks (e,g,
isOpen(data-time)
,expired(...)
) etc.
HTML and XHTML Builder
- Base Document Builder: Build the structure of a basic HTML or XHTML document.
- XML/XHTML Builder: Create XML or XHTML documents with full support for namespaces, attributes, and elements.
- XML/XHTML Builder Examples: Practical examples of how to use the XML/XHTML builder for common tasks.
- Input Form Builder: Generate form input fields, such as text, radio, and select elements, with custom attributes.
- Input Form Builder Examples: Example code demonstrating how to build input forms using the form builder.
Logging
- Static Logger Class: A logging class that offers static methods for writing logs to various destination, including
telegram
andemail
. - Aware Logger: A logger that integrates with different parts of the system, capturing detailed information about context and behavior.
- NovaLogger Class: A specialized logger class designed to provide advanced features such as backup, performance login and more.
- Log Levels: Defines the different levels of logging.
Tasks
- CronJob Tasks Scheduling: Schedule tasks to run at specified intervals, using cron-like syntax for flexibility.
- CronJob Tasks Execution: Manage the execution of scheduled cron jobs, including handling errors and retries.
Notifications
- Firebase Cloud Messaging: Integrate Firebase Cloud Messaging to send push notifications to web and mobile clients.
- Cloud Message Model: A model for structuring messages to be sent through various notification services.
- Notification Examples: Example use cases for different notification types and sending methods.
Architecture & Interfaces
HMVC
- HMVC Design Pattern: Understand the Hierarchical Model-View-Controller (HMVC) design pattern for building modular and scalable applications.
Interface and Exception Classes
- Interface Classes: A guide to the use of interface classes for defining contracts and ensuring consistent implementation.
- Exception Handling & Classes: Learn how exceptions are handled in Luminova, with a focus on custom exception classes and error management.
Error Handling and Debugging
- Exception & Error Codes: A reference for understanding and utilizing error codes within the Luminova framework to handle issues effectively.
- Global Error Controller: Centralized error management for catching and displaying errors throughout your application.
- Application Debugging: Tools and strategies for debugging your application, including enabling debug mode and inspecting logs.
Developer Tools
Command Line Tools
- Novakit Commands: Access a collection of commands in the Novakit toolset for enhancing command-line development.
- PHP Development Server: Running a built-in PHP development server for local application testing and debugging.
- Command Helper Class (Terminal): A class providing utility methods for working with the terminal, including handling input/output.
- Command Text Util: Utilize text utilities for formatting and managing output within command-line applications.
- Command Color Util: Enhance command-line output with color formatting for better readability and user interaction.
- Command Ascii Image Art: Generate ASCII art images for visual representation within command-line applications.
- Command Examples: Practical examples showcasing how to use the available command-line tools and utilities effectively.
Real-Time Communication
- HTTP Socket Server: Set up and manage an HTTP socket server for real-time communication within web applications.
- HTTP Socket Server Examples: Example implementations and use cases for the HTTP socket server in real-time applications.