Rewriting a monolithic CodeIgniter 3 application all at once usually stalls feature delivery for months and introduces regressions across billing, permissions, and customer portals. IgniteCore applies the Strangler Fig architectural pattern inside Perfex CRM Classic: legacy CI3 routes stay untouched for everyday stability while new endpoints, heavy APIs, and modern UI modules are intercepted incrementally and executed inside an isolated CodeIgniter 4 runtime.
See the practical payoff in our CI3 vs CI4 Perfex CRM speed benchmark and security comparison.
| Strangler Fig Layer | Responsibility | Perfex Integration Mechanism |
|---|---|---|
| Edge Router | Splits /ignite/* traffic from legacy URLs | Apache/Nginx rewrite rules before CI3 index.php |
| Session & Auth Bridge | Validates logged-in staff and clients | Reads shared CI3 session store and tblstaff permissions |
| Shared Data Plane | Maintains single source of truth in MySQL | Injects Perfex APP_DB_* and table prefix into CI4 |
| Safety Boundary | Prevents bad modules from crashing core | Auto-Quarantine Guard and dual-mode CI3 fallback |
1. Edge Interception Without Core Hacks
In a classic Strangler Fig setup, an edge proxy decides whether an incoming HTTP request goes to the legacy system or the modern service. IgniteCore implements this edge boundary directly at the web server and front-controller layer. Standard URLs like /admin/invoices pass straight to CI3, whereas /ignite/{module}/{route} boots only CodeIgniter 4, skipping legacy global loaders completely.
- Route new REST APIs, webhook consumers, and heavy builders through
/ignite/*to avoid CI3 startup overhead. - Preserve existing Perfex admin menus by rendering thin iframe-free shell wrappers or native dual-mode entry points.
- Keep core
application/andsystem/directories 100% unmodified so official Perfex security patches apply cleanly.
2. Unifying Auth, Permissions, and Domain Data
Running two frameworks fails if users must log in twice or data diverges. IgniteCore solves state synchronization through a shared session decoder and database config bridge, letting CI4 controllers enforce Perfex’s native has_permission() capabilities and CSRF protections seamlessly alongside dual-mode module workflows.
- Decode Classic session cookies in a CI4
Filterso staff never experience extra login prompts across routes. - Map Perfex role permissions (
view,create,edit,delete) directly onto CI4 controller middleware attributes. - Wrap cross-module writes in database transactions using the shared MySQL connection pool to prevent partial updates.
Common Pitfalls and Quick Fixes
- Attempting to load CI3
$CI =& get_instance()inside CI4 controllers: Never mix CI3 superglobals into CI4 services; use IgniteCore’s PSR-4BridgeContextor database repositories instead. - Duplicated configuration files getting out of sync: Read database credentials and
APP_ENC_KEYdynamically from Perfex’sapp-config.phprather than maintaining a second.envcopy. - Cross-framework cache invalidation gaps: Trigger unified cache key flushes via IgniteCore event hooks whenever either CI3 or CI4 updates shared settings.
Frequently Asked Questions
Why use the Strangler Fig pattern instead of upgrading Perfex CI3 core directly?
Modifying Perfex’s core framework from CodeIgniter 3 to 4 directly would break every third-party module on the market and lock you out of official Perfex updates. The Strangler Fig bridge lets you gain CI4 speed and security incrementally without sacrificing ecosystem compatibility.
Does running CI3 and CI4 together double PHP memory usage per request?
No. A single HTTP request executes only one framework. Legacy pages boot only CI3, while /ignite/* routes boot only CodeIgniter 4 and the shared bridge adapter, resulting in lower memory usage and faster execution on modern endpoints than legacy CI3 pages.
How does IgniteCore keep staff sessions synchronized between CI3 and CI4?
IgniteCore’s authentication filter reads the active Perfex session cookie and validates it against the same tblsessions table or PHP session save path used by CodeIgniter 3, resolving the authenticated staff ID, client contact, and role permissions before any CI4 controller executes.
Can I migrate an existing CI3 module endpoint by endpoint with IgniteCore?
Yes. That is the core strength of the Strangler Fig pattern. You can move slow reporting APIs or complex form handlers into CI4 routes one feature at a time while leaving stable legacy screens on CI3 until you are ready to retire them.

Leave a Reply