Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
WorkerMode
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3namespace Config;
4
5/**
6 * This configuration controls how CodeIgniter behaves when running
7 * in worker mode (with FrankenPHP).
8 */
9class WorkerMode
10{
11    /**
12     * Persistent Services
13     *
14     * List of service names that should persist across requests.
15     * These services will NOT be reset between requests.
16     *
17     * Services not in this list will be reset for each request to prevent
18     * state leakage.
19     *
20     * Recommended persistent services:
21     * - `autoloader`: PSR-4 autoloading configuration
22     * - `locator`: File locator
23     * - `exceptions`: Exception handler
24     * - `commands`: CLI commands registry
25     * - `codeigniter`: Main application instance
26     * - `superglobals`: Superglobals wrapper
27     * - `routes`: Router configuration
28     * - `cache`: Cache instance
29     *
30     * @var list<string>
31     */
32    public array $persistentServices = [
33        'autoloader',
34        'locator',
35        'exceptions',
36        'commands',
37        'codeigniter',
38        'superglobals',
39        'routes',
40        'cache',
41    ];
42
43    /**
44     * Reset Event Listeners
45     *
46     * List of event names whose listeners should be removed between requests.
47     * Use this if you register event listeners inside other event callbacks
48     * (rather than at the top level of Config/Events.php), which would cause
49     * them to accumulate across requests in worker mode.
50     *
51     * @var list<string>
52     */
53    public array $resetEventListeners = [];
54
55    /**
56     * Force Garbage Collection
57     *
58     * Whether to force garbage collection after each request.
59     * Helps prevent memory leaks at a small performance cost.
60     */
61    public bool $forceGarbageCollection = true;
62}