hhxsv5/laravel-s
51.8
Adequate · 17 November 2026
4.8k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
Add Prometheus metrics collection for LaravelS applications
Introduces a new Prometheus integration that automatically collects and exposes metrics for Swoole workers, system resources, and HTTP requests. The change adds a service provider to register collectors (HTTP, Swoole process/stats, system) and an exporter that renders APCu-backed metrics in Prometheus text format. A background collector process and a timer-based cron job handle periodic metric gathering, while a request middleware captures per-request data after the response is sent.
src/Components/Prometheus · high confidence
Added coroutine-aware HTTP client trait
A new \SimpleHttpTrait\ has been introduced in the \HttpClient\ component to provide a unified interface for making HTTP GET requests. This trait automatically detects if the code is running within a Swoole coroutine context; if so, it utilizes Swoole's native coroutine HTTP client for non-blocking performance, otherwise it falls back to standard cURL. The implementation handles response parsing, header extraction, and timeout configuration, ensuring consistent behavior regardless of the execution environment.
src/Components/HttpClient · high confidence
Added coroutine-local context storage for LaravelS
A new \Context\ class has been introduced in the \src/Swoole/Coroutine\ directory to provide coroutine-local storage capabilities within the LaravelS framework. This component allows data to be stored and retrieved on a per-coroutine basis using Swoole's coroutine ID, ensuring that context variables remain isolated between concurrent coroutines. It includes methods to get, put, and delete context items, as well as a utility to check if the current execution is inside a coroutine, facilitating better state management in asynchronous Swoole applications.
src/Swoole/Coroutine · high confidence
Initial release of LaravelS integration layer
This change introduces the core \LaravelS\ class, which bridges the Swoole HTTP server with the Laravel framework. It enables the handling of HTTP and WebSocket requests by converting Swoole requests to Laravel requests, managing the Laravel application lifecycle (including session persistence on WebSocket open), and firing specific lifecycle events such as ServerStart, ServerStop, WorkerStart, WorkerStop, and WorkerError. The implementation also integrates support for custom processes, inotify-based file watching for hot reloading, and timer processes.
src · high confidence
Introduce Apollo configuration management component
Adds a new Apollo component to the application, introducing a Client class for fetching and saving configuration data from an Apollo server and a Process class that runs as a background worker to watch for configuration changes and trigger application reloads. The component supports initialization via environment variables or command-line options, handles namespace-based configuration pulling, and automatically updates the .env file while backing up previous versions if configured.
src/Components/Apollo · high confidence
Introduce Swoole-based async task and event dispatching
Added new abstract classes (BaseTask, Task, Event, Listener) in src/Swoole/Task that enable asynchronous task execution and event handling via Swoole. Tasks and events can now be delayed using a configurable delay in seconds and support retry logic via a configurable number of tries. The implementation uses Swoole's task queue for immediate delivery and Timer::after for delayed execution, ensuring compatibility with Swoole's worker model.
src/Swoole/Task · high confidence
Introduce Symfony-based LaravelS console command with environment and Apollo support
The \src/Console/Portal.php\ file introduces a new Symfony Console-based entry point for the LaravelS tool, replacing or augmenting previous command structures. This change adds the \--env\ option to allow users to specify the environment file (e.g., \.env.production\) at startup, and the \--x-version\ option to inject a project version into the server environment. It also integrates Apollo configuration support via \Client::attachCommandOptions\ and \loadApollo\, enabling dynamic config loading. The command now checks for both \swoole\ and \openswoole\ extensions, supports daemon mode, and provides a structured interface for start, stop, restart, reload, and info actions.
src/Console · high confidence
Introduce request-scoped cleaners to reset Laravel state between requests
This change adds a suite of cleaner classes (AuthCleaner, ConfigCleaner, ContainerCleaner, CookieCleaner, DcatAdminCleaner, JWTCleaner, LaravelAdminCleaner, MenuCleaner, RequestCleaner, SessionCleaner, and ZiggyCleaner) to the src/Illuminate/Cleaners directory. These components are designed to reset specific application states—such as authentication guards, session drivers, container rebound callbacks, and third-party admin panel instances—after each request. This ensures that static or singleton state from one request does not leak into subsequent requests in long-running Swoole processes.
src/Illuminate/Cleaners · high confidence
Introduces a global timer mechanism with Redis-based locking and health checks
The Swoole Timer component now supports a global timer mode that uses Redis to coordinate timer execution across multiple processes. This is achieved by introducing a new \CronJob\ abstract class and specific implementations: \BackupCronJob\ prevents the timer process from exiting when no other timers are active, \RenewGlobalTimerLockCronJob\ maintains the Redis lock to keep the timer alive, and \CheckGlobalTimerAliveCronJob\ verifies the lock's validity. The \TimerTrait\ now conditionally registers these auxiliary jobs when \global\_lock\ is enabled in the configuration, ensuring that only one instance executes the primary timer logic at a time while others monitor its health.
src/Swoole/Timer · high confidence
Introduces abstract socket classes and interfaces for HTTP, TCP, UDP, and WebSocket protocols
The \src/Swoole/Socket\ directory now provides a structured foundation for handling different network protocols by introducing abstract base classes (\Http\, \TcpSocket\, \UdpSocket\, \WebSocket\) and corresponding interfaces (\HttpInterface\, \TcpInterface\, \UdpInterface\, \WebSocketInterface\, \PortInterface\). These components define standard event signatures for Swoole server ports, such as \onConnect\, \onReceive\, \onMessage\, and \onPacket\, allowing developers to extend these classes to implement custom protocol handlers within the LaravelS framework.
src/Swoole/Socket · high confidence
New Prometheus collectors for HTTP, Swoole, and system metrics
Added four new metric collectors to the Prometheus integration: HttpRequestCollector tracks HTTP request counts, sums, and maximum durations using APCu with a configurable time window (default 60s); SwooleProcessCollector exposes per-process memory usage and garbage collection statistics; SwooleStatsCollector reports Swoole server stats including worker/task counts and connection numbers; and SystemCollector provides system load averages. These collectors enable detailed monitoring of application performance and infrastructure health via Prometheus.
src/Components/Prometheus/Collectors · high confidence
New Swoole lifecycle event interfaces for server and worker phases
The \src/Swoole/Events\ directory now includes new interfaces (\ServerStartInterface\, \ServerStopInterface\, \WorkerStartInterface\, \WorkerStopInterface\, and \WorkerErrorInterface\) that allow developers to hook into specific Swoole server and worker lifecycle events. These interfaces define the expected method signatures for handling server start/stop and worker start/stop/error events, enabling custom logic to be executed at these critical points in the Swoole process lifecycle.
src/Swoole/Events · high confidence
New bin scripts for file watching and LaravelS management
Added executable scripts in the bin directory to streamline development workflows: \bin/fswatch\ and \bin/inotify\ now automatically monitor PHP file changes in a specified working directory and trigger a LaravelS reload, while \bin/laravels\ provides a standalone entry point to manage the LaravelS process (start, restart, reload) with an optimized autoloader that explicitly registers Symfony dependencies to resolve class-loading issues.
bin · high confidence
New configuration files for LaravelS and Prometheus metrics
This change introduces two new configuration files: \config/laravels.php\ and \config/prometheus.php\. The \laravels.php\ file provides a centralized configuration for the LaravelS Swoole server, allowing users to adjust server settings such as listen IP/port, socket type, static resource handling, inotify reload behavior, event handlers, WebSocket support, custom processes, and timer-based cron jobs. The \prometheus.php\ file enables Prometheus metrics collection, with configurable options to enable/disable the collector, set the application name, manage APCu key prefixes and TTLs, define time windows for max duration metrics, ignore specific HTTP status codes, and set the metrics collection interval.
config · high confidence
Support for custom Swoole processes with reload and restart capabilities
Users can now define and run custom background processes within the LaravelS application. This change introduces a \CustomProcessInterface\ that requires a \callback\ method for the main process logic and an \onReload\ method to handle graceful reloading via the SIGUSR1 signal. The implementation in \CustomProcessTrait\ allows configuring multiple process instances, setting restart intervals when a process exits, and optionally enabling message queues. It also ensures process titles are set correctly across different environments (using \cli\_set\_process\_title\ or \swoole\_set\_process\_name\) and manages PID files for monitoring.
src/Swoole/Process · high confidence
Behavioural changes
Refactored request cleanup and provider registration into modular components
The monolithic request handling logic in \src/Illuminate/Laravel.php\ has been split into dedicated classes to improve maintainability and fix state-leakage issues between requests. A new \CleanerManager\ now centralizes the cleanup of the application container, configuration, cookies, and requests via pluggable \CleanerInterface\ implementations, while a \ReflectionApp\ class encapsulates the reflection-based logic required to safely re-register service providers and manage the \loadedProviders\ state across different Laravel and Lumen versions. Additionally, a new \ListPropertiesCommand\ has been added to help developers identify controller properties that may persist across requests due to the singleton nature of the Swoole workers.
src/Illuminate · high confidence
Support for PHP 8.2+ dynamic properties in Swoole server proxies
Added HttpServerProxy and WebSocketServerProxy classes that extend Swoole's native Server classes and are annotated with the \#\[\\AllowDynamicProperties\] attribute. This change ensures compatibility with PHP 8.2+ by allowing dynamic properties on these server instances, which is required for features like Swoole Tables that rely on dynamic property assignment.
src/Swoole/Proxy · high confidence
Swoole integration refactored with new request/response handling and file watch support
The Swoole server layer has been restructured to improve request handling, response streaming, and development workflow. Request parsing now correctly maps HTTP headers to $\_SERVER variables and fixes the REQUEST\_URI construction. Response handling is split into specialized classes: DynamicResponse supports chunked streaming for large or streamed content, StaticResponse uses sendfile for efficient file delivery, and the base Response class now supports HTTP trailers and raw cookies. Additionally, a new Inotify-based file watcher allows automatic application reloading when source files change, configurable by file type and excluded directories.
src/Swoole · high confidence
Test coverage
Added HTTP client and performance testing infrastructure
Added a new PHPUnit test suite for the SimpleHttpTrait to verify HTTP GET requests, including a base TestCase class. Additionally, introduced an avg-qps.sh script to benchmark average queries per second using Apache Bench (ab). Also in this area: 3 commits adding/updating tests in tests.
tests · high confidence · unverified
Dependencies
57 commits updating dependencies (1 manifest)
A dependency / build maintenance change in (dependencies) — 57 commits (7 fixs), 1 file: “fix composer description”; “detail readme”; “bring symfony command”; and 46 more.
(dependencies) · medium confidence · unverified
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 52.3 → 51.8 (-0.5)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 56.5 → 56.1 (-0.4)
- Architecture 96.2 → 88.0 (-8.2)
- Maturity 55.5 → 55.5 (0.0)
- Readiness 39.0 → 39.0 (0.0)
- Security 90.0 → 90.0 (0.0)
Resolved (2)
- Duplicated block (10–11 lines × 2) (src/Console/Portal.php)
- No ADRs found
New (6)
- Circular dependency (src/LaravelS.php)
- Edited copy of a member (10 corresponding lines) (src/Swoole/Server.php)
- Edited copy of a member (12 corresponding lines) (src/LaravelS.php)
- Edited copy of a member (12 corresponding lines) (src/Swoole/Response.php)
- Edited copy of a member (21 corresponding lines) (src/LaravelS.php)
- No ADRs found (composer.json)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
hhxsv5/laravel-s was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 5e5684c204b12b3938409fc4b81aef0bb7ea1502 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.