Full Changelog Starting from Version 3.3.0 and Above
Name | Description |
---|---|
Version Code | 3.3.8 |
Version Name | Nobu |
Published | 2023-11-22 22:40:01 |
Updated | 2024-11-22 22:40:01 |
General Overview
Luminova 3.3^ introduces major updates and performance improvements. Key features of this release include:
- HMVC Support: Build applications using the Hierarchical Model-View-Controller (HMVC) modular architecture.
- Network Testing: Test applications on various network-connected devices with the NovaKit PHP development server.
- Static Page Cache Versioning: Utilize the
app.version
environment variable to manage cache versions. Previous versions can be specified as an array inpage.cache.app.versions
environment variable for rendering cached content: (e.g,page.cache.app.versions = [1.0.0, 1.1.0]
). - New Utility Classes: Enhanced functionality with the introduction of classes for:
- Event Handling
- XHtml Document Building
- Input Field Building
- Process Execution
New Features
Since 3.3.8
Lazy Object Initialization:
IntroducesLazyObject
an way to delay object instantiation until they are accessed. By utilizing PHP 8.4.0ReflectionClass::newLazyGhost
or fallback for earlier version, developers can optimize memory usage and improve application performance.Lazy Interface:
Adds theLuminova\Utils\LazyInterface
as a marker interface for classes that support lazy loading. This interface ensures type compatibility when working with lazy-initialized objects, allowing easy integration with strongly-typed properties and method signatures. By implementingLuminova\Interface\LazyInterface
, developers can align their custom classes with theLazyObject
functionality, enhancing code clarity and maintainability.Fiber Async Execution: Introduced new async class
Luminova\Utils\Async
, this class utilizes only the PHPFiber
for asynchronous operations. With easy to use methods liketask
,await
,until
next
,sleep
run
and more for easy usage.Logger Enhancements
- Added support for HTTP network and email logging. This allows asynchronous delivery of log messages to a remote server or email address in production environments.
- New environment variables introduced:
logger.mail.logs
: Specifies the email address for error logs.logger.remote.logs
: Defines the remote server URL for error logging viaPOST
requests.
Application Configuration Classes: Added new configuration classes
App\Config\Logger
to manage application message logging andApp\Config\Mailer
to manage application email messaging.
Since 3.3.6
- Command Image Art: Introduced an image art module to convert images into ASCII art for terminal display, enhancing the visual experience in command-line interfaces.
- Logging Enhancements: Added support for email and network logging in production environments, allowing logs to be sent via email or to a remote server. To enable this feature, set
logger.mail.logs
with the target email address andlogger.remote.logs
with the remote server endpoint.Additionally, support for log backups has been added. To enable automatic backups when a log file reaches its maximum size, setlogger.create.backup
totrue
. The maximum file size (in bytes) before backup can be specified withlogger.max.size
.
Since 3.3.4
- Async Background Task Queue Class: Added a new method,
onResponse
, to allow the registration of a callback that handles the response after each task execution. The callback receives the current result, previous cumulative results, and the instance of theLuminova\Utils\Queue
class. - Array Merge Result Function: Introduced the
array_merge_result
function, enabling easy merging of responses of any data type into an existing results variable. - Temporal Directory Function: Added the
get_temp_dir
function, which creates and returns the system's temporary directory or file name.
Since 3.3.3
- HTTP Socket Server: Introduced a new module for creating a simple and flexible HTTP server. This module allows you to open a socket connections to listen for incoming requests, including support for
WebSocket
andSocket.IO
requests. It also has routing capability to route request and handle real-time communications effectively. - Routing: Introduced support for a generic method
ANY
(orRouter::ANY_METHODS
), enabling routing for any HTTP method, including custom request methods. This enhancement improves performance by allowing a single index to handle all methods instead of creating separate indexes for each HTTP method (e.g.,GET|POST|PUT|DELETE|PATCH
, etc.). By usingANY
, the router efficiently manages routes, reducing overhead and improve request handling. - Routing Strict Segment Placeholders : Added support for strict placeholder patterns, in both
HTTP
andCLI
routing, applicable to both Router Attribute and method-based routing to simplify the segment capturing based on datatype, making it more accessible for beginners compared to traditional regex patterns. - Routing Prefix Attribute: Introduced support for the
Prefix
attribute, allowing you to define specific URI patterns or prefixes that a controller class is allowed to handle. This ensures that all routes within the controller are scoped under a common path, providing better organization and easier management of routes in larger applications. It is particularly useful for grouping related routes, such as versioned API endpoints or modular components of the application. - HTTP Network Request Response: Enhanced support for the
Stringable
interface, allowing the request response body to be easily converted to a string format suitable for network transmission. - HTTP File Upload Object: Introduced a new method
getContent
and the constructor property$contents
(type:string|null
). This enhancement enables the reception and upload of files directly from a string, even when thetemp_name
is unavailable or not required, providing greater flexibility in file handling. HTTP Method Override Support: Introduced
_OVERRIDE_REQUEST_METHOD_
to enable spoofing of HTTP request methods. Clients can now send aPOST
orGET
request with a hidden input or query parameter named_OVERRIDE_REQUEST_METHOD_
to specify an alternative HTTP method. If this parameter is present, the server's request method will be overridden with the provided value, allowing applications to simulate methods likePUT
orDELETE
in environments that only supportPOST
orGET
. This feature enhances testing capabilities and improves compatibility with various client scenarios.Example: Overriding to
PUT
using aPOST
request<form method="POST" action="/update-resource"> <input type="hidden" name="_OVERRIDE_REQUEST_METHOD_" value="PUT"> <input type="text" name="resource_data" value="Updated Content"> <button type="submit">Submit</button> </form>
In this example, although the form uses
POST
, the server will treat the request as aPUT
request because of the_OVERRIDE_REQUEST_METHOD_
parameter.Example: Overriding to
DELETE
using aGET
request<a href="/delete-resource?id=123&_OVERRIDE_REQUEST_METHOD_=DELETE">Delete Resource</a>
Here, the server will treat the
GET
request as aDELETE
request because of the_OVERRIDE_REQUEST_METHOD_
parameter appended to the query string.
Since 3.3.0
- HMVC (Hierarchical Model-View-Controller): Luminova now supports HMVC for modular application development. This feature is disabled by default and can be enabled through the environment variable
feature.app.hmvc
. - XHTML Document Builder: A new class,
Luminova\Builder\Xhtml
, has been added to facilitate programmatic HTML document generation. - Form Input Builder: The
Luminova\Builder\Inputs
class helps in dynamically generating form elements and input fields in HTML. - Event Handling: Introduces
Luminova\Utils\Event
, a class for managing event listeners and callbacks. - HMVC Controller Module Definition: The new
setModule
method in the application class allows defining the module name for controllers, facilitating template discovery within modules. - Words Uppercase Function: The
uppercase_words
helper function converts the first letter of each word to uppercase. It also handles underscores (_
) and hyphens (-
), converting them to spaces before applying capitalization. - Array Merge Recursively and Replace: The
array_merge_recursive_replace
helper function merges multiple arrays recursively. When two arrays share the same key, values from the second array overwrite those from the first. Numeric keys are appended only if the value doesn't already exist in the array. - Array Merge Recursively and Distinctively: The
array_merge_recursive_distinct
helper function merges arrays recursively, but unlike traditional recursive merging, it replaces duplicate values rather than appending them. When two arrays contain the same key, the value in the second array replaces the one in the first array. - Array Extend Default: The
array_extend_default
helper function merges two arrays, treating the first array as the default configuration and the second as new or override values. If both arrays contain nested arrays, they are merged recursively, ensuring that default values are preserved and new values are added where applicable.
Optimizations & Updates
Since 3.3.8
Adapted Lazy Loading Interface: Optimized classes and implemented lazy load marker interface for classes that my request lazy loading such as
Luminova\Base\BaseModel
,Luminova\Database\Connection
,Luminova\Database\Builder
,Luminova\Seo\Schema
,Luminova\Http\Request
,Luminova\Http\File
,Luminova\Http\Server
,Luminova\Http\Header
,Luminova\Security\Validation
,Luminova\Notifications\Notification
and more.Adapted Lazy Loading: Optimized base controllers classes to utilize lazy loading for properties like
$request
,$validate
to defer the initialization till when needed.HTTP Incoming Request Class: Enhanced to support reading entire multipart requests and converting requests to multipart format.
NovaKit Commands
- Database Migration and Seeding: Improved performance and database management.
- Cron Task Execution: Optimized execution with support for the
--sleep
or-s
option to control delays between task executions.
Performance Profiling: Enhanced for more human-readable calculations.
- Added detailed metrics, including:
- Controller & Method
- Cache Status
- Skipped Controllers
- Other valuable performance insights.
Since 3.3.6
- HTTP File Upload Object: Enhanced the HTTP file upload object to detect files uploaded via blob or browser chunking. Added a method to retrieve the file's MIME type directly from the temporary upload.
- Command Terminal Class: Improved the command terminal class, introducing additional methods and refactoring the table generation to support custom foreground, border, and header colors.
- Command Text Utility: Refined the text utility class for commands, adding more methods and enhancing options for creating visually rich, HTML-like layouts in the terminal.
- Command Color Utility: Streamlined the color utility class, removing redundant color definitions and adding convenient magic methods for more flexible color handling.
- Logger Helper Function: Updated to support logging via email, remote server, or file with default log levels. Now includes optional asynchronous execution for non-blocking logging operations.
Since 3.3.4
- Asynchronous Queue Class: Optimized for efficient background task handling with optional support for PHP 8.1 Fiber. If Fiber is unavailable, it attempts to use
pcntl_fork
. If neither is available, it gracefully falls back to the default implementation. - Process Executor Class: Enhanced for efficient process management with optional support for PHP 8.1 Fiber. When Fiber is unavailable, it defaults to the standard implementation.
- HTTP Socket Server Class: Improved to efficiently manage simultaneous connections and optimize the execution lifecycle.
- Command Execution Helper Class: Enhanced the
flush
method to correctly handle cases where the output exceeds the terminal window width and wraps. By passing the last output text as an argument to theflush
method, it ensures that the wrapped output is properly cleared from the terminal. - Sitemap Generator: Optimized sitemap and introduce new configuration
public
property$scanSpeed
, to controller the delay for downloading content from each URL, impacting the overall speed of the sitemap generation process.
Since 3.3.3
- HTTP Request Class: Enhanced the HTTP request constructor to support the creation of custom HTTP request objects, including request methods, headers, body, and files. Improved the capturing of incoming requests for better performance, incorporating support for
Stringable
interface to convert the request body to a string. - Improved Input Escaper Function: The global helper function
escape
has been enhanced to usehtmlspecialchars
for both HTML and attribute contexts, eliminating unnecessary initialize to the escaper class.
Since 3.3.0
- Routes Attribute Compiler: This class has been optimized to efficiently handle controller classes with a defined
Prefix
attribute, ensuring that routes are properly scoped and organized. It also processes attributes more effectively, by storing cached attributes by prefix resulting in improved performance. - NovaKit Command Enhancements: The
create:controller
command now supports the HMVC modular pattern. A new argument-module
has been introduced to specify the module name when generating controller classes. - Sitemap Generator: Optimized sitemap generator to skips
404
error URLs. This version also introduces the followingpublic
properties:- $includeStaticHtml: (
bool
) When set to true, this property includes static.html
URLs in the sitemap. - $skipStaticHtml: (
array<string,string>
)This property allows the definition of specific URL patterns to exclude from static URL generation, providing more control over the sitemap content. - $changeFrequently: (
string|null
) This property allows you to define the frequency of URL changes, offering search engines valuable insights for indexing.
- $includeStaticHtml: (
Bug Fixes
Resolved in 3.3.8
- Database Seeding Command: Addressed an issue causing locked versions to be recreated without any new changes during seeding.
- Firebase Notifications: Fixed media attachments in APNs through the Notification Message Model.
- Core Application Lifecycle: Resolved an issue in the
onCreate
method to ensure it executes only once during the application lifecycle, even if a new instance is manually created.
Changes & Renaming
Since 3.3.8
- ORM Database Builder
__construct
Method: Updated the constructor toprivate
to restrict initialization outside ofgetInstance
ortable
methods.table
Method: Madestatic
to ensure it returns a shared instance and creates a newLuminova\Database\Builder
object only when necessary.
Since 3.3.0
Directory Change:
/resources/views/
has been renamed to/resources/Views/
for consistency.Controller Namespace Changes:
App\Controllers\MyHttpAndApiControllers
should be moved toApp\Controllers\Http\MyHttpAndApiControllers
for organizing HTTP-related controllers inside/app/Controllers/Http/
.App\Controllers\MyCommandControllers
should now be placed inApp\Controllers\Cli\MyCommandControllers
, moving all CLI controllers to/app/Controllers/Cli/
.
Removed
Since 3.3.8
Utility Class Loop: The class name
Luminova\Utils\Loop
have been removed in favor of the newLuminova\Utils\Async
with better execution capabilities.Removed Base Controller Methods: Methods like
request()
,validate()
andapp()
has been removed from base controllers in favor of lazy object loading adaptation.
To-Do List
Since 3.3.8
1. Application File Configuration Class:
Resolved issue properties signatures in Application File Configuration Class.
filePermissions
public int $filePermissions = int-value;
// To
public static int $filePermissions = int-value;
dirPermissions
public int $dirPermissions = int-value;
// To
public static int $dirPermissions = int-value;
2. Add Logger Configuration Class:
Add logger configuration class if not already exist. See properties reference.
// /app/Config/Logger.php
<?php
namespace App\Config;
use \Luminova\Base\BaseConfig;
final class Logger extends BaseConfig {}
2. Add Mailer Configuration Class:
Add mailer configuration class if not already exist. See properties reference.
// /app/Config/Mailer.php
<?php
namespace App\Config;
use \Luminova\Base\BaseConfig;
final class Mailer extends BaseConfig {}
For Luminova versions earlier than 3.3.0
, the below changes are required manually.
1. Sitemap Configuration:
In your Sitemap Configuration Class, add new properties $changeFrequently
, $includeStaticHtml
and $skipStaticHtml
if it doesn't already exist.
// /app/Config/Sitemap.php
<?php
namespace App\Config;
use \Luminova\Base\BaseConfig;
final class Sitemap extends BaseConfig {}
2. Update Controller Class Namespaces
To adhere to the new directory structure, you should create two new folders, Http
and Cli
, inside your Controllers
directory. Move all HTTP controllers to app/Controllers/Http/
, and all CLI command controllers to app/Controllers/Cli/
.
app/
/Modules/ (for HMVC Modules)
Controllers/ (Base Controllers)
Http/
Cli/
Foo/
Models/
Views/
Controllers/ (Foo Controllers)
Http/
Cli/
Controllers/ (for MVC Controllers)
Http/
Cli/
HTTP Controller Example:
// /app/Controllers/Http/HttpController.php
<?php
namespace App\Controllers\Http;
use Luminova\Base\BaseController;
class HttpController extends BaseController
{
//...
}
Command Controller Example:
// /app/Controllers/Cli/CommandController.php
<?php
namespace App\Controllers\Cli;
use Luminova\Base\BaseCommand;
class CommandController extends BaseCommand
{
//...
}