2017 © Pedro Peláez
 

library cakephp-ifl-custom-utility

CakePHP Utility classes such as Inflector, String, Hash, and Security

image

israelfl/cakephp-ifl-custom-utility

CakePHP Utility classes such as Inflector, String, Hash, and Security

  • Monday, April 10, 2017
  • by israelfl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Total Downloads License, (*1)

CakePHP Utility Classes

This library provides a range of utility classes that are used throughout the CakePHP framework, (*2)

What's in the toolbox?

Hash

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

$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, (*4)

Inflector

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

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

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

Check the official Inflector class documentation, (*6)

Text

The Text class includes convenience methods for creating and manipulating strings., (*7)

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, (*8)

Security

The security library handles basic security measures such as providing methods for hashing and encrypting data., (*9)

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

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

Check the official Security class documentation, (*10)

Xml

The Xml class allows you to easily transform arrays into SimpleXMLElement or DOMDocument objects and back into arrays again, (*11)

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

Check the official Xml class documentation, (*12)

The Versions

10/04 2017

dev-master

9999999-dev

CakePHP Utility classes such as Inflector, String, Hash, and Security

  Sources   Download

MIT

10/04 2017

1.0.2

1.0.2.0

CakePHP Utility classes such as Inflector, String, Hash, and Security

  Sources   Download

MIT