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.2 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.2
      • 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
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • IniReader
  • PhpReader

Class PhpReader

PHP Reader allows Configure to load configuration values from files containing simple PHP arrays.

Files compatible with PhpReader should define a $config variable, that contains all of the configuration data contained in the file.

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

Properties summary

  • $_path protected
    string
    The path this reader finds files on.

Method Summary

  • __construct() public
    Constructor for PHP Config file reading.
  • dump() public

    Converts the provided $data into a string of PHP code that can be used saved into a file and loaded later.

  • read() public
    Read a config file and return its contents.

Method Detail

__construct() public ¶

__construct( string $path = null )

Constructor for PHP Config file reading.

Parameters
string $path optional null
The path to read config files from. Defaults to APP . 'Config' . DS

dump() public ¶

dump( string $filename , array $data )

Converts the provided $data into a string of PHP code that can be used saved into a file and loaded later.

Parameters
string $filename

The filename to create on $this->_path. Extension ".php" will be automatically appended if not included in filename.

array $data
Data to dump.
Returns
integer
Bytes saved.

read() public ¶

read( string $key )

Read a config file and return its contents.

Files with . in the name will be treated as values in plugins. Instead of reading from the initialized path, plugin keys will be located using App::pluginPath().

Parameters
string $key

The identifier to read from. If the key has a . it will be treated as a plugin prefix.

Returns
array
Parsed configuration values.
Throws
ConfigureException

when files don't exist or they don't contain $config. Or when files contain '..' as this could lead to abusive reads.


Implementation of
ConfigReaderInterface::read()

Properties detail

$_path ¶

protected string

The path this reader finds files on.

null
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