r/PHPhelp • u/Ok_Understanding850 • Apr 29 '25
Solved General Question Client wants No-code Rule System
I have a client that wants me to build a widget generator based on rules they can modify without touching the codebase.
Think of the widget as a VIN.
Example 1) If the car is a blue sedan, it has 22” wheels, rear seat, has a large windshield, black tinted windows, output widget BLU22WNSLGWBLKT4W.
Example 2) if the car is a red coupe, 19” wheels, has rear seat, large windshield, black tinted windows, output widget RED19WRSLGWBLKT2W
Do you know of any rule-based libraries that could help me achieve this?
2
Upvotes
5
u/SecurityHamster Apr 29 '25
No, seems rather niche. Sounds like a fun thing for you to build though!
5
u/ryantxr Apr 29 '25
They are just making a new programming language. The rules become the code.
4
u/randombagofmeat Apr 29 '25
This seems like something that wouldn't be hard to build from scratch, just assign the corresponding codes to the inputs that should be as easy as key value pairs. I don't see why you would want the overhead of a complicated library for this.
2
u/samhk222 Apr 29 '25
I didn't get the complexity of this. It's a product and the product have characteristcs, and for each caracteristic you have a short name for it and at the end you just concatenate those?
Sorry, i really didn't get it
5
u/Big-Dragonfly-3700 Apr 29 '25
All of this should be database driven, where the choices for each field making up a part number, are stored in a database. You would have an administrative web form for adding new choices, such as a new color choice.
At the point of creating/inserting a new product, there would be a web form with a select/option menu for each field making up a part number, getting the choices from the database, along with fields for the name, description, ... of the product. It is up to the user to select the correct values that match the new product and to proofread and confirm that the choices they made are correct. When this data is inserted into the item/product database table, you should actually store each field as a separate column (this will make searches easy and fast), and you can create a composite unique index on the columns to prevent/detect duplicates.
1
u/HolyGonzo Apr 29 '25
What are the generated "widgets" supposed to do?
It's easy enough to build out a simple rule engine, but generating a widget is ambiguous.
1
u/BarneyLaurance May 18 '25
Seems like the client is effectively contradicting themselves. The collection of rules that they would modify would be a form of codebase. Being stored in a database instead of git (which is really just a database engine designed specifically for storing codebases) doesn't make it not a codebase, it just makes it a badly managed codebase.
I'd want to look into what the issues behind them not wanting to be "touching the codebase" are.