![]() |
How to use Codeigniter with other framework? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How to use Codeigniter with other framework? (/showthread.php?tid=90711) |
How to use Codeigniter with other framework? - sr13579 - 04-22-2024 I would like to use the database classes and methods in other PHP frameworks. I have an idea if I include the autolader from vendor it will work, but I can't find a tutorial about that. Could anyone please help me? RE: How to use Codeigniter with other framework? - Bosborne - 04-22-2024 I think you need to choose a framework. They are not generally designed to inter-operate. I chose to move from Laravel because I was not using many of the included features and it appears slow to my clients. I ended up choosing Codeigniter due to its light weight and speed. For my needs, we really need to move a longer term supported release including patches but without breaking changes. The current reading changes and file changes can be daunting, especially if your enterprise project is several releases behind, RE: How to use Codeigniter with other framework? - kenjis - 04-22-2024 This might be helpful. https://github.com/kenjis/ci4-session-in-plain-php RE: How to use Codeigniter with other framework? - sr13579 - 04-24-2024 (04-22-2024, 02:39 PM)kenjis Wrote: This might be helpful. It is still not enough. I am trying to get inside autoload vendor. RE: How to use Codeigniter with other framework? - kenjis - 04-24-2024 1. Install "codeigniter4/framework" via Composer. 2. add dependencies (constants, functions, etc.) in somewhere when needed. RE: How to use Codeigniter with other framework? - sr13579 - 04-25-2024 (04-24-2024, 03:44 PM)kenjis Wrote: 1. Install "codeigniter4/framework" via Composer. Let me try another time. Suppose you want to use CI4 in another framework that does not support composer autoloader. I am a noob at this. But I can understand that there are class path that I can use. But I don't know the class names or the namespaces. Have you heard of Eloquent from Laravel. We can use this independently anywhere. RE: How to use Codeigniter with other framework? - kenjis - 04-25-2024 All you have to do is: 1. Before using a class or function, load the class or function definition. 2. Before using a constant, define the constant. So this is not difficult (but may be bothersome) if you know how to use PHP. CI4 follows PSR-4, so if you have or write a PSR-4 autoloader, it can autoload class files. CI4 uses namespace "CodeIginter". See https://github.com/codeigniter4/CodeIgniter4/blob/8738340277a89d47b083ed45f24dd0eb81cd563b/composer.json#L63-L65 If there is something missing to load/define, PHP raises an error. So you just the load/define missing things. |