mark_story 37d4e37f4c Try to get travis to pass again. 7 年之前
..
Crypto 370fe1ebb2 3.next - Add deprecation warnings to the Utility package 8 年之前
Exception a41e63ea6c Add the $previous argument to all exceptions 8 年之前
CookieCryptTrait.php 3a6bd75832 Use HTTPS for the opensource.org URL 8 年之前
Hash.php 37d4e37f4c Try to get travis to pass again. 7 年之前
Inflector.php 18ecbbcf3a Added irregular rule for 'cache' 8 年之前
LICENSE.txt c61ab5ee95 Use HTTPS for the cakefoundation.org URL 8 年之前
MergeVariablesTrait.php 3a6bd75832 Use HTTPS for the opensource.org URL 8 年之前
README.md fe1d812c89 Update URL in *.md, *.json 9 年之前
Security.php d2f7f1d310 Deprecate Security::rijndael(). 8 年之前
String.php 37bbe08abb Add warnings for moved classes. 8 年之前
Text.php 8702658dc5 Fix postfix assignment mistake 8 年之前
Xml.php 6442b9ee6f Implemented code review changes. 8 年之前
bootstrap.php 3a6bd75832 Use HTTPS for the opensource.org URL 8 年之前
composer.json 8400540c75 Add missing core dependencies and bump versions. 8 年之前

README.md

Total Downloads License

CakePHP Utility Classes

This library provides a range of utility classes that are used throughout the CakePHP framework

What's in the toolbox?

Hash

A Hash (as in PHP arrays) class, capable of extracting data using an intuitive DSL:

$things = [
    ['name' => 'Mark', 'age' => 15],
    ['name' => 'Susan', 'age' => 30],
    ['name' => 'Lucy', 'age' => 25]
];

$bigPeople = Hash::extract($things, '{n}[age>21].name');

// $bigPeople will contain ['Susan', 'Lucy']

Check the official Hash class documentation

Inflector

The Inflector class takes a string and can manipulate it to handle word variations such as pluralizations or camelizing.

echo Inflector::pluralize('Apple'); // echoes Apples

echo Inflector::singularize('People'); // echoes Person

Check the official Inflector class documentation

Text

The Text class includes convenience methods for creating and manipulating strings.

Text::insert(
    'My name is :name and I am :age years old.',
    ['name' => 'Bob', 'age' => '65']
);
// Returns: "My name is Bob and I am 65 years old."

$text = 'This is the song that never ends.';
$result = Text::wrap($text, 22);

// Returns
This is the song
that never ends.

Check the official Text class documentation

Security

The security library handles basic security measures such as providing methods for hashing and encrypting data.

$key = 'wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA';
$result = Security::encrypt($value, $key);

Security::decrypt($result, $key);

Check the official Security class documentation

Xml

The Xml class allows you to easily transform arrays into SimpleXMLElement or DOMDocument objects and back into arrays again

$data = [
    'post' => [
        'id' => 1,
        'title' => 'Best post',
        'body' => ' ... '
    ]
];
$xml = Xml::build($data);

Check the official Xml class documentation