Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

quangdog's avatar

Is Lumen A Good Fit For My Use Case?

I'm starting a new project, and am looking for the right micro-service rest api framework to use. I have a few somewhat unusual project requirements though, and I'm wondering how well Lumen supports the following:

  1. UUID instead of integer for primary keys. For various historical reasons, this project (which is the next-generation of an existing product) uses UUID's for primary keys (and all foreign key relationships) in the database tables. Many of the frameworks I've looked at so far more or less assume primary keys will always just be an auto-incremented integer. How well does Lumen deal with UUIDs instead? Storage space is not really a concern, so I'm happy to store them as 32 byte varchars, but could also do it the more recommended way of storing them as 16 byte binary blobs. I just want to know if Lumen will play nice with non-standard keys. With the ORM layer still be able to traverse relationships between tables, etc?

  2. Separate database schemas per client. I recognize this is also very unusual, but it's also required for this project: I'll be using MariaDB as my database, which will have a global schema (let's call it Subscriptions) that Lumen will consult to validate requests (i.e., is the api request coming with a valid api key, that is not expired or canceled, etc). Once the request is known to be valid, then it needs to switch to a different schema (or database name) in MariaDB which houses that account's data. So if I have 5 customer subscriptions, MariaDB will actually house 6 databases: Subscriptions, client 1, client 2, ... client 5. When a new client signs up, a new db schema will be created, so Lumen needs to be able to connect on-the-fly to a different schema, based on the authentication (keys, tokens, whatever) that the client provides. Is this possible?

I've used several other frameworks so I'm not coming to this with no experience, but this is the first time I've really considered Lumen (or Laravel) for any project.

To be clear: I only need to build a json rest api - all the front-end UI will be provided by a different group entirely.

Thanks in advance for any insight you can lend.

0 likes
6 replies
mabdullahsari's avatar

Ditch Lumen, use Laravel. Taylor has been discouraging the use of Lumen for ages now. Laravel is fast enough to handle almost anything. If you need to squeeze as much performance as possible though, you can also use Octane which runs on Swoole/Roadrunner.

  1. Eloquent supports non-AI PKs, so no problem. However, it does not support composite keys (like most ORMs I guess?)
  2. This is called a multitenant application. There are a lot of opinionated solutions out there already to help you with the boilerplate.

Laravel is also a perfect fit for building a JSON API. Like I said, anything. One's imagination is the sole barrier.

GL

quangdog's avatar

Thank you very much for the insight! My initial research into the differences between Laravel and Lumen indicated that Lumen offered a significant performance bump, but it's very likely those reviews/opinions were based on older versions (from when Lumen first appeared a few years back).

I'll dig into the links for multitenancy you provided as well.

Thank you!

mabdullahsari's avatar

Laravel has improved a lot over the years. The couple ms saved in the boot time of the framework does not outweigh the massive benefits you get by using Laravel. You can always disable some service providers you deem useless for your app.

1 like
quangdog's avatar

I'm detecting a theme: Go with full blown Laravel. Any regrets with that decision now that a few months have passed?

Thanks!

automica's avatar

not for us. we've got other apps in laravel so keeping them all on the same framework is also a big benefit.

1 like

Please or to participate in this conversation.