Skip to content
comhon-project edited this page Jun 11, 2020 · 14 revisions

Table of content

  1. Summary
  2. Example
  3. List

Summary

Comhon! allow you to set some configurations. They must be stored in a json file. By default Comhon! will search the file config.json in folder where you have launched your script.

But you may configure where configuration file must be searched. To do so, in your entrypoint script just add following lines :

use Comhon\Object\Config\Config;

// must be called before any Comhon functions
Config::setLoadPath('my/absolute/or/relative/path/to/my_config.json');

Warning!! Configuration file is required and an exception will be thrown if file is not found.

Example

Configuration file looks like :

{
  "manifestFormat": "json",
  "autoload": {
    "manifest":{
      "Test":"../manifests/test/manifest"
    },
    "serialization":{
      "Test":"../manifests/test/serialization"
    },
    "options":{
      "Test":"../manifests/test/options"
    }
  },
  "request_collection_limit":20,
  "regexList":"./regex.json",
  "sqlTable": "./table",
  "sqlDatabase": "./database",
  "dateTimeFormat": "c",
  "database": {
    "charset": "utf8",
    "timezone": "UTC"
  }
}

List

We will explain one by one each available configurations. But before we have to explain configurations that describe a path. Each path may be absolute or relative. A path is considered as relative only if path begin with a . (or ..). A relative path is relative to configuration file.

manifestFormat

Define in wich format you have defined your Manifests, Serialization and Options. Allowed format are json and xml (default json)

autoload

Define namespaces prefixes and path where Manifests, Serialization and Options must be found. See Manifests, Serialization and Options pages for more informations.

request_collection_limit

Default limit that is applied when requesting objects collection with complex requester in public context. This limit may be overridden for each model.

regexList

Define path where regex list file must be found. Actually you may define some regex to validate values (see pattern).

sqlTable

Define path to directory that contain all your sql tables informations. By default Comhon! will look into folder named table in folder where your script is launched.

sqlDatabase

Define path to directory that contain all your sql databases informations. By default Comhon! will look into folder named database in folder where your script is launched.

dateTimeFormat

Define default date time format to use when import/export datetimes values (default 'c' that is ISO 8601).

database

Define some informations to configure database connection :

  • charset
  • timezone

Clone this wiki locally