This package includes object-oriented wrapper classes for PHP strings, arrays,
and regular expressions (respectively, Jitsu\XString
, Jitsu\XArray
, and
Jitsu\XRegex
). These classes simply build upon the functions in the packages
jitsu/string
,
jitsu/array
, and
jitsu/regex
, providing an
object-oriented interface to the static methods implemented there. The OOP
versions automatically unwrap their arguments and wrap their return values.
This package is part of Jitsu.
Install this package with Composer:
composer require jitsu/wrap
All classes are defined under the namespace Jitsu
.
Here's a quick example to illustrate this package's tremendous usefulness:
use Jitsu\XArray;
use Jitsu\XString;
// Wisdom from the ancient Romans?
$s = new XString('Repus Terces Egassem');
// Maybe not...
echo $s->split()->map(function($s) {
return (new XString($s))->lowerFirst()->reverse()->capitalize();
})->join(' '), "\n";
// => Super Secret Message
An object-oriented wrapper for the string
type.
See jitsu/string.
Type | |
---|---|
$value |
`string |
An object-oriented wrapper class for the array
type.
See jitsu/array.
Type | |
---|---|
$value |
`array |
Type | |
---|---|
returns | string |
An object-oriented wrapper for PHP's PCRE patterns.
See jitsu/regex.
Type | Description | |
---|---|---|
$arg |
`string | \Jitsu\XString |
$flags |
`string | \Jitsu\XString` |
$start |
`string | \Jitsu\XString |
$start |
`string | \Jitsu\XString |