Welcome Guest, Not a member yet? Register   Sign In
Best way to create microservices projects with CodeIgniter 4
#1
Question 

Hello ! Is there a good way to create multiple microservices projects using CodeIgniter 4? I see every where that Symfony is a good framework to do this, but I prefer to use CodeIgniter 4! Thanks Big Grin
Reply
#2

CI4 is smaller than Symfony minimum installation.

Symfony 7.0.6: 11M
CI 4.5.1: 5.7M (without Composer dev packages)

What's your issue?
Reply
#3

Than you for your answer.

I need to create a project with a microservices architecture. I use CodeIgniter from CI2 and I want to use it for this project. There is a picture who show the architecture here : https://www.atlassian.com/microservices/...chitecture

When I search to create these architecture in PHP on Google, I founds lot of topics for Symfony. I don't know if there is a tuto or a github project who show us how to do this using CI4.

I see on CI documentation that we can create multiple applications with one CI installation : https://www.codeigniter.com/user_guide/g..._apps.html

I don't know if this is a good way, or there is a better way to do this?

For example, I want this architecture:
- API Gateway
--- Customer service
--- Product service
--- Order service
--- Invoice service

The user can connect using Customer service, next he can see all products using Product service and add to cart using Order service. When the order is completed, an Invoice is generated using Invoice service. Each services is an individual project who have an instance of CI.

I want to use JWT to communicate between each services.

I don't know if all is clear?
Reply
#4

(This post was last modified: 04-21-2024, 11:52 PM by Avega Soft.)

You can use HMVC architecture in your project. Each service will be a separate module (yes, CI4 supports modularity) with its own database (if necessary). And there will be a common core application for working with incoming data, including working with JWT. This is how I would solve your problem
Reply
#5

Thank you for your answer.

I understand your way, but I already use modularity in the project to separate some features. So, my goal is to convert these modules in microservices, because I want to use same microservice for multiple projects. For example, I need Invoice microservice for project A who are hosted on server X, and for project B who are hosted on server Y, and tomorrow for project C, etc.

I want to extract my current modules in microservices.
Reply
#6

You can make independent microservices modules with your own database and migrations. You can add this module to the composer like as Shield/Settings e.t. And use it in all your projects within the framework ecosystem. If I understood your idea correctly
Reply
#7

One microservice is one independent app. It should not share code with other microservices.
So, for example, you can use CI for Customer service, can use Symfony for Product service,
and even you can use other language for Order service.
Reply
#8

I agree, one microservice = one app instance.

I used CodeIgniter since years and I want to stay on this framework. Symfony seems to be a good alternative for this kind of project, there is a lot of documentation to do this. Some topics explain the good way to create microservice with Symfony (or Laravel).

Is there also a good way to do that with CI? I didn't find any documentation or examples. It will be interesting to have an example.
Reply
#9

CodeIgniter 4 User Guide - Running Multiple Applications with one CodeIgniter Installation
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

(04-23-2024, 11:32 PM)jean5769 Wrote: Symfony seems to be a good alternative for this kind of project, there is a lot of documentation to do this. Some topics explain the good way to create microservice with Symfony (or Laravel).

For example?

Microservices do not depend on specific frameworks.
So if that article is really useful, it should be helpful no matter what framework you use.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB