4
I need to develop an application that fits several projects with common functionalities, however each has several specific rules.
What I need is a structure that allows me to easily change these rules, in case I chose to save the rules in the database and use the function eval()
to execute the code in the application, however, I don’t think this would be the best option to get the result I need (nor the most secure, even if the rules are encrypted).
Structure I’m using now is:
app
controller [controllers]
model [models] [aqui são aplicados as regras do banco de dados]
entity [entidades do banco de dados]
repository [model <=> entity]
helper [helpers]
view [views]
theme [themes]
config
[configurações da aplicação]
data
logs [app logs]
cache [view cache]
public
[módulos angular, assets, index.php e .htaccess]
vendor
[libraries, app-core]
The rules would be applied more or less like this:
// Random key (config)
define('PRIVATE_KEY', 'SECURE_RANDOM_KEY');
// antes
foreach ( regras as regra )
parse(decode(regra, PRIVATE_KEY));
// continua execução
Any idea how I could improve this?
Run of
eval
orpreg_replace
modifiere
. Not a good idea anyway– Wallace Maxters
the structure is nice. I just advise to include a folder "lib" or "Libraries" inside the folder "app". You have "Ibraries" for "vendor", but you need to have your Ibraries for the app engine. Another one that I think is important is "override". Inside this folder would have the same structure as the folders "app" and "config". Override is to allow the programmer to customize native functions without having to modify the original files. Roughly speaking, override, is an organized "gambiarra".
– Daniel Omine