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
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.4 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.4
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 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

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Namespace Global

Function Detail

__() ¶

__(string $singular, array ...$args): string|null

Returns a translated string if one is found; Otherwise, the submitted message.

Parameters
string $singular

Text to translate.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__

__d() ¶

__d(string $domain, string $msg, array ...$args): string|null

Allows you to override the current domain for a single message lookup.

Parameters
string $domain

Domain.

string $msg

String to translate.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__d

__dn() ¶

__dn(string $domain, string $singular, string $plural, int $count, array ...$args): string|null

Allows you to override the current domain for a single plural message lookup. Returns correct plural form of message identified by $singular and $plural for count $count from domain $domain.

Parameters
string $domain

Domain.

string $singular

Singular string to translate.

string $plural

Plural.

int $count

Count.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__dn

__dx() ¶

__dx(string $domain, string $context, string $msg, array ...$args): string|null

Allows you to override the current domain for a single message lookup. The context is a unique identifier for the translations string that makes it unique within the same domain.

Parameters
string $domain

Domain.

string $context

Context of the text.

string $msg

String to translate.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__dx

__dxn() ¶

__dxn(string $domain, string $context, string $singular, string $plural, int $count, array ...$args): string|null

Returns correct plural form of message identified by $singular and $plural for count $count. Allows you to override the current domain for a single message lookup. The context is a unique identifier for the translations string that makes it unique within the same domain.

Parameters
string $domain

Domain.

string $context

Context of the text.

string $singular

Singular text to translate.

string $plural

Plural text.

int $count

Count.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__dxn

__n() ¶

__n(string $singular, string $plural, int $count, array ...$args): string|null

Returns correct plural form of message identified by $singular and $plural for count $count. Some languages have more than one form for plural messages dependent on the count.

Parameters
string $singular

Singular text to translate.

string $plural

Plural text.

int $count

Count.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__n

__x() ¶

__x(string $context, string $singular, array ...$args): string|null

Returns a translated string if one is found; Otherwise, the submitted message. The context is a unique identifier for the translations string that makes it unique within the same domain.

Parameters
string $context

Context of the text.

string $singular

Text to translate.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__x

__xn() ¶

__xn(string $context, string $singular, string $plural, int $count, array ...$args): string|null

Returns correct plural form of message identified by $singular and $plural for count $count. Some languages have more than one form for plural messages dependent on the count. The context is a unique identifier for the translations string that makes it unique within the same domain.

Parameters
string $context

Context of the text.

string $singular

Singular text to translate.

string $plural

Plural text.

int $count

Count.

array ...$args

Array with arguments or multiple arguments in function.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__xn

breakpoint() ¶

breakpoint(): string

Command to return the eval-able code to startup PsySH in interactive debugger Works the same way as eval(\Psy\sh()); psy/psysh must be loaded in your project

Returns
string
Links
http://psysh.org/ ``` eval(breakpoint()); ```

collection() ¶

collection(Traversable|array $items): Cake\Collection\Collection

Returns a new Cake\Collection\Collection object wrapping the passed argument.

Parameters
Traversable|array $items

The items from which the collection will be built.

Returns
Cake\Collection\Collection

dd() ¶

dd(mixed $var, bool|null $showHtml = null): void

Prints out debug information about given variable and dies.

Only runs if debug mode is enabled. It will otherwise just continue code execution and ignore this function.

Parameters
mixed $var

Variable to show debug information for.

bool|null $showHtml optional

If set to true, the method prints the debug data in a browser-friendly way.

Returns
void
Links
https://book.cakephp.org/3.0/en/development/debugging.html#basic-debugging

debug() ¶

debug(mixed $var, bool|null $showHtml = null, bool $showFrom = true): mixed

Prints out debug information about given variable and returns the variable that was passed.

Only runs if debug mode is enabled.

Parameters
mixed $var

Variable to show debug information for.

bool|null $showHtml optional

If set to true, the method prints the debug data in a browser-friendly way.

bool $showFrom optional

If set to true, the method prints from where the function was called.

Returns
mixed
Links
https://book.cakephp.org/3.0/en/development/debugging.html#basic-debugging

https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#debug

env() ¶

env(string $key, string|null $default = null): string|null

Gets an environment variable from available sources, and provides emulation for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on IIS, or SCRIPT_NAME in CGI mode). Also exposes some additional custom environment information.

Parameters
string $key

Environment variable name.

string|null $default optional

Specify a default value in case the environment variable is not defined.

Returns
string|null
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#env

h() ¶

h(string|array|object $text, bool $double = true, string|null $charset = null): string

Convenience method for htmlspecialchars.

Parameters
string|array|object $text

Text to wrap through htmlspecialchars. Also works with arrays, and objects. Arrays will be mapped and have all their elements escaped. Objects will be string cast if they implement a __toString method. Otherwise the class name will be used.

bool $double optional

Encode existing html entities.

string|null $charset optional

Character set to use when escaping. Defaults to config value in mb_internal_encoding() or 'UTF-8'.

Returns
string
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#h

loadPHPUnitAliases() ¶

loadPHPUnitAliases(): void

Loads PHPUnit aliases

This is an internal function used for backwards compatibility during fixture related tests.

Returns
void

namespaceSplit() ¶

namespaceSplit(string $class): array

Split the namespace from the classname.

Commonly used like list($namespace, $className) = namespaceSplit($class);.

Parameters
string $class

The full class name, ie Cake\Core\App.

Returns
array

pj() ¶

pj(mixed $var): mixed

json pretty print convenience function.

In terminals this will act similar to using json_encode() with JSON_PRETTY_PRINT directly, when not run on cli will also wrap

 tags around the output of given variable. Similar to pr().

This function returns the same variable that was passed.

Parameters
mixed $var

Variable to print out.

Returns
mixed
See Also
pr()
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#pj

pluginSplit() ¶

pluginSplit(string $name, bool $dotAppend = false, string|null $plugin = null): array

Splits a dot syntax plugin name into its plugin and class name. If $name does not have a dot, then index 0 will be null.

Commonly used like

list($plugin, $name) = pluginSplit($name);
Parameters
string $name

The name you want to plugin split.

bool $dotAppend optional

Set to true if you want the plugin to have a '.' appended to it.

string|null $plugin optional

Optional default plugin to use if no plugin is found. Defaults to null.

Returns
array
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#pluginSplit

pr() ¶

pr(mixed $var): mixed

print_r() convenience function.

In terminals this will act similar to using print_r() directly, when not run on cli print_r() will also wrap

 tags around the output of given variable. Similar to debug().

This function returns the same variable that was passed.

Parameters
mixed $var

Variable to print out.

Returns
mixed
See Also
debug()
Links
https://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#pr

stackTrace() ¶

stackTrace(array $options = []): mixed

Outputs a stack trace based on the supplied options.

Options

  • depth - The number of stack frames to return. Defaults to 999
  • args - Should arguments for functions be shown? If true, the arguments for each method call will be displayed.
  • start - The stack frame to start generating a trace from. Defaults to 1
Parameters
array $options optional

Format for outputting stack trace

Returns
mixed
OpenHub
Pingping
Linode
  • 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
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs