Hi,
I would like to integrate an existing CodeIgniter4 Project into another existing PHP project for migration purposes.
The simplest idea I could come up with was to simply include / require the public/index.php of the Codeiginiter Setup.
CodeIgniter would still use its router and all services, but within another application.
Let me describe my (minimized) setup:
I have a standard codeigniter4 project in /webroot/codeigniter.
I have a PHP file /webroot/index.php that simply requires the public/index.php with the content
PHP Code:
<?php
require __DIR__ . '/codeigniter/public/index.php'
?>
This results in the following error:
Call to a member function shouldDiscover() on null
/vendor/codeigniter4/framework/system/Config/BaseService.php: 37
I'm unsure how to fix this. I suspect this could be a path issue, but since we can find BaseService.php, this seems to work reasonably fine.
Here are my questions:
1. What do I have to fix to make this work?
2. Is this a reasonable approach at all? Are there better ways to "integrate" a CodeIgniter Application into existing PHP infastructure?
3. Do you know of any guides how to accomplish such a task?