The Fulcrum Extender module - extending the PHP array, PHP strings, and WordPress functionality.
- Array Module - making it easier to work with PHP arrays, especially deeply nested array. It includes "dot" notation.
- String Module - providing the missing PHP string functionality
- WP Module - providing some missing WordPress functionality
Working with arrays is tedious, especially deeply nested arrays. This module provides a handful of useful functions including borrowing from Laravel's "dot" notation.
Dot notation is a clever mechanism to access deeply nested arrays using a string of the keys separated by dots.
For example, let's say you have a deeply nested array like this one:
$user = array(
'user_id' => 504,
'name' => 'Bob Jones',
'social' => array(
'twitter' => '@bobjones',
),
'languages' => array(
'php' => array(
'procedural' => true,
'oop' => false,
),
'javascript' => true,
'ruby' => false,
),
);
To drill down to Bob's twitter handle, you'd pass 'social.twitter'
and to get to whether he likes OOP or procedural, you'd pass 'languages.php.oop'
or 'languages.php.procedural'
.
Credit: Taylor Otwell brought us "dot" notation in the Laravel framework. Using his concept, Fulcrum adapts it to fit WordPress running on PHP 5.6 and up.
Each of these functions is documented in the Wiki.
* indicates this function works with "dot notation".
We often need functionality to test if a string has, starts with, or ends with a character or substring. This module includes functionality for checking, converting, and truncating strings.
Each of these functions is documented in the Wiki.
We often need extra functionality to make our jobs easier when working with WordPress. This module adds functionality for checking, getting, and preparing.
Each of these functions is documented in the Wiki.
All feedback, bug reports, and pull requests are welcome.