public class Configuration

class.configuration.php #15

The Configuration class acts as a property => value store for settings used throughout Symphony. The result of this class is a string containing a PHP representation of the properties (and their values) set by the Configuration. Symphony's configuration file is saved at CONFIG. The initial file is generated by the Symphony installer, and then subsequent use of Symphony loads in this file for each page view. Like minded properties can be grouped.

Constants

static string TAB = ' '

The string representing the tab characters used to serialize the configuration

Methods

void __construct(boolean $forceLowerCase)

The constructor for the Configuration class takes one parameter, $forceLowerCase which will make all property and group names lowercase or not. By default they are left to the case the user provides

Parameters
  • $forceLowerCase booleanFalse by default, if true this will make all property and group names lowercase

string __toString()

This magic __toString function converts the internal $this->_properties array into a string representation. Symphony generates the MANIFEST/config.php file in this manner.

Returns

A string that contains a array representation of $this->_properties. This is used by Symphony to write the config.php file.

See Also
void flush()

Empties all the Configuration values by setting $this->_properties to an empty array

array|string|integer|float|boolean get(string $name, string $group)

Accessor function for the $this->_properties.

Parameters
  • $name stringThe name of the property to retrieve

  • $group stringThe group that this property will be in

Returns

If $name or $group are not provided this function will return the full $this->_properties array.

void remove(string $name, string $group)

The remove function will unset a property by $name. It is possible to remove an entire 'group' by passing the group name as the $name

Parameters
  • $name stringThe name of the property to unset. This can also be the group name

  • $group stringThe group of the property to unset

void set(string $name, array|string|integer|float|boolean $value, string $group)

Setter for the $this->_properties. The properties array can be grouped to be an 'array' of an 'array' of properties. For instance a 'region' key may be an array of 'properties' (that is name/value), or it may be a 'value' itself.

Parameters
  • $name stringThe name of the property to set, eg 'timezone'

  • $value array|string|integer|float|booleanThe value for the property to set, eg. '+10:00'

  • $group stringThe group for this property, eg. 'region'

void setArray(array $array, boolean $overwrite)

A quick way to set a large number of properties. Given an associative array or a nested associative array (where the key will be the group), this function will merge the $array with the existing configuration. By default the given $array will overwrite any existing keys unless the $overwrite parameter is passed as false.

Parameters
  • $array arrayAn associative array of properties, 'property' => 'value' or 'group' => array('property' => 'value')

  • $overwrite booleanAn optional boolean parameter to indicate if it is safe to use array_merge or if the provided array should be integrated using the 'set()' method to avoid possible change collision. Defaults to false.

boolean write(string $file, integer|null $permissions)

Function will write the current Configuration object to a specified $file with the given $permissions.

Parameters
  • $file stringthe path of the file to write.

  • $permissions integer|null(optional) the permissions as an octal number to set set on the resulting file. If this is not provided it will use the permissions defined in [write_mode][file]

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details