CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.1 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.1
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
    • Network
      • Email
      • Http
    • Routing
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • IniReader
  • PhpReader

Class IniReader

Ini file configuration parser. Since IniReader uses parse_ini_file underneath, you should be aware that this class shares the same behavior, especially with regards to boolean and null values.

In addition to the native parse_ini_file features, IniReader also allows you to create nested array structures through usage of . delimited names. This allows you to create nested arrays structures in an ini config file. For example:

db.password = secret would turn into array('db' => array('password' => 'secret'))

You can nest properties as deeply as needed using .'s. In addition to using . you can use standard ini section notation to create nested structures:

{{{ [section] key = value }}}

Once loaded into Configure, the above would be accessed using:

`Configure::read('section.key');

You can combine . separated values with sections to create more deeply nested structures.

IniReader also manipulates how the special ini values of 'yes', 'no', 'on', 'off', 'null' are handled. These values will be converted to their boolean equivalents.

IniReader implements ConfigReaderInterface
Package: Cake\Configure
See: http://php.net/parse_ini_file
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Configure/IniReader.php

Properties summary

  • $_path protected
    array
    The path to read ini files from.
  • $_section protected
    string
    The section to read, if null all sections will be read.

Method Summary

  • __construct() public

    Build and construct a new ini file parser. The parser can be used to read ini files that are on the filesystem.

  • _parseNestedValues() protected
    parses nested values out of keys.
  • read() public
    Read an ini file and return the results as an array.

Method Detail

__construct() public ¶

__construct( string $path , string $section = null )

Build and construct a new ini file parser. The parser can be used to read ini files that are on the filesystem.

Parameters
string $path
Path to load ini config files from.
string $section optional null

Only get one section, leave null to parse and fetch all sections in the ini file.

_parseNestedValues() protected ¶

_parseNestedValues( array $values )

parses nested values out of keys.

Parameters
array $values
Values to be exploded.
Returns
array
Array of values exploded

read() public ¶

read( string $file )

Read an ini file and return the results as an array.

Parameters
string $file

Name of the file to read. The chosen file must be on the reader's path.

Returns
array
Throws
ConfigureException
Implementation of
ConfigReaderInterface::read()

Properties detail

$_path ¶

protected array

The path to read ini files from.

$_section ¶

protected string

The section to read, if null all sections will be read.

OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs