Terminology/naming of a default setup/environment class
-
07-09-2020 - |
Question
I'm working on yet another framework for PHP, and have run into a small dilemma. I'm currently working with the core modules, which all are supposed to work stand-alone but I'd like to have a class that creates a default setup or environment that can be used directly or extended by your app. So I need to find a good term/name for this class.
Current candidates:
- Engine
- Environment
- Main
- Base
- Init / Initializer
- Bootstrap
- App / Application (Chosen!)
The class resides in the Core
-namespace, i.e. Framework/Core/ClassName
.
Since I can't decide on which one to use I'm hoping you guys can help me pick the right one by shedding some more light on the terminologies of frameworks. I welcome new additions to the list above.
Just to make this as clear as possible, here's an example of how it's intended to be used:
use Framework/Core/ClassName as App;
// Create instance
$app = new App;
$app->run();
// Static initialization
App::run();
The above will setup a default environment with the most commonly used features of a modern framework. It will load config and url files from default locations and also setup default dispatch routes.
Solution
i usually try to use separate my Application and Config objects. Like
class MyApp extends App
task specific methods
class MyConfig extends Config
task specific settings
$app = new MyApp(new MyConfig);
$app->run();
The former can be called App(lication), Engine, Dispatcher, etc - something that emphasises it "actor" nature, the latter can be Environment, Config, Settings, Options etc.
OTHER TIPS
Just did a small front-controler based app quite similar to your implementation. I named my initialisaation class a very unoriginal "Init". It's the class that loads settings, sets up error handling, logging and optionaly, db connection and site-wide registry.
TlDR: Init is the name I retained for this when faced with same question.