CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 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

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • IniConfig
  • JsonConfig
  • PhpConfig

Class PhpConfig

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

Files compatible with PhpConfig should return an array that contains all of the configuration data contained in the file.

An example configuration file would look like::

<?php
return [
    'debug' => false,
    'Security' => [
        'salt' => 'its-secret'
    ],
    'App' => [
        'namespace' => 'App'
    ]
];
Cake\Core\Configure\Engine\PhpConfig implements Cake\Core\Configure\ConfigEngineInterface uses Cake\Core\Configure\FileConfigTrait
Namespace: Cake\Core\Configure\Engine
See: Cake\Core\Configure::load() for how to load custom configuration files.
Location: Core/Configure/Engine/PhpConfig.php

Properties summary

  • $_extension protected
    string
    File extension.

Inherited Properties

  • _path

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|null $path = null )

Constructor for PHP Config file reading.

Parameters
string|null $path optional null
The path to read config files from. Defaults to CONFIG.

dump() public ¶

dump( string $key , 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 $key

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

array $data
Data to dump.
Returns
boolean
Success
Implementation of
Cake\Core\Configure\ConfigEngineInterface::dump()

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 Plugin::path().

Setting a $config variable is deprecated. Use return instead.

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
Cake\Core\Exception\Exception

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


Implementation of
Cake\Core\Configure\ConfigEngineInterface::read()

Methods used from Cake\Core\Configure\FileConfigTrait

_getFilePath() protected ¶

_getFilePath( string $key , boolean $checkExists = false )

Get file path

Parameters
string $key

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

boolean $checkExists optional false
Whether to check if file exists. Defaults to false.
Returns
string
Full file path
Throws
Cake\Core\Exception\Exception

When files don't exist or when files contain '..' as this could lead to abusive reads.


Properties detail

$_extension ¶

protected string

File extension.

'.php'
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs