Skip to content
Khen Solomon Lethil edited this page Nov 13, 2017 · 10 revisions

As we just finished up initiating our composer package, we now, need to setup and configurate our application. In this setup we will learn letId folders and file(Namespace) structure. Before we begin, we need 3 folders under our working directory...

  1. Public (web directories/index)
  2. Application (entire app/)
  3. Configuration (config/routeController)

Public

Public directory contain our default PHP index file and other public accessible files such as favicon, robots, .htaccess. As it's received every HTTP requests, we will use PHP index file to connect our Applications Configuration. If we prefer other name than public there is no restriction for naming this folder.

Preferable: public, www, root, html etc...
default: public

Application

The Application folder will holds all of our applications in this package.

Preferable: app, pro, root etc...
default: app

In order to change from the default app, we just need to add the following lines in composer.json and replace app with desire name. Its a namespace for the applications, as well as Application root

...
"autoload": {
    "psr-4": {
        "app": "config/"
    }
}
...

Configuration

The config folder has one file routeController.php that hold the Core configuration for $application, $rewrite, $setting, $directory, $configuration

If we prefer other name than config there is not restriction for naming this folder. It's also possible that routeController.php can be placed in our Public directory, however Public directory is not safe place for sensitive information.

Preferable: config, host, common, shared, core etc...
default: config

Application (folder) => hostname (regex without slashs)

protected $application = array(
    'localhost'=>"localhost",
    'example'=>array(
        "example.com",".example.com",".example."
    ),
    'storage-example'=>"storage.example"
);

protected $directory = array(
    'template'=>'template'
    'language'=>'language'
);

protected $configuration = array(
    'language_default'=>'en',
    'ANS'=>__NAMESPACE__
);

the Application's Namespace.

const ANS = __NAMESPACE__;

📌 this can not be modified!

the Application's Directory.

const ADR = __DIR__;

📌 this can not be modified. Not in used (at the moment)!

Clone this wiki locally