PHPackages                             jitsu/wrap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jitsu/wrap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jitsu/wrap
==========

Wrapper classes for strings, arrays, and regexes with chainable methods

0.1.2(10y ago)071MITPHPPHP &gt;=5.3.0

Since Sep 19Pushed 10y ago1 watchersCompare

[ Source](https://github.com/bdusell/jitsu-wrap)[ Packagist](https://packagist.org/packages/jitsu/wrap)[ RSS](/packages/jitsu-wrap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

jitsu/wrap
----------

[](#jitsuwrap)

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`](https://github.com/bdusell/jitsu-string), [`jitsu/array`](https://github.com/bdusell/jitsu-array), and [`jitsu/regex`](https://github.com/bdusell/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](https://github.com/bdusell/jitsu).

Installation
------------

[](#installation)

Install this package with [Composer](https://getcomposer.org/):

```
composer require jitsu/wrap
```

Namespace
---------

[](#namespace)

All classes are defined under the namespace `Jitsu`.

Usage
-----

[](#usage)

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
```

API
---

[](#api)

### class Jitsu\\XString

[](#class-jitsuxstring)

An object-oriented wrapper for the `string` type.

See [jitsu/string](https://github.com/bdusell/jitsu-string).

#### new XString($value = '')

[](#new-xstringvalue--)

Type**`$value`**`string#### $x\_string-&gt;\_\_toString()

[](#x_string-__tostring)

#### XString::unwrap($x)

[](#xstringunwrapx)

#### $x\_string-&gt;length()

[](#x_string-length)

#### $x\_string-&gt;size()

[](#x_string-size)

#### $x\_string-&gt;isEmpty()

[](#x_string-isempty)

#### $x\_string-&gt;equal($that)

[](#x_string-equalthat)

#### $x\_string-&gt;iEqual($that)

[](#x_string-iequalthat)

#### $x\_string-&gt;chars()

[](#x_string-chars)

#### $x\_string-&gt;chunks($n)

[](#x_string-chunksn)

#### $x\_string-&gt;split($delim = null, $limit = null)

[](#x_string-splitdelim--null-limit--null)

#### $x\_string-&gt;tokenize($chars)

[](#x_string-tokenizechars)

#### $x\_string-&gt;join($strs = null)

[](#x_string-joinstrs--null)

#### $x\_string-&gt;trim($chars = null)

[](#x_string-trimchars--null)

#### $x\_string-&gt;rtrim($chars = null)

[](#x_string-rtrimchars--null)

#### $x\_string-&gt;ltrim($chars = null)

[](#x_string-ltrimchars--null)

#### $x\_string-&gt;lower()

[](#x_string-lower)

#### $x\_string-&gt;upper()

[](#x_string-upper)

#### $x\_string-&gt;lcfirst()

[](#x_string-lcfirst)

#### $x\_string-&gt;lowerFirst()

[](#x_string-lowerfirst)

#### $x\_string-&gt;ucfirst()

[](#x_string-ucfirst)

#### $x\_string-&gt;upperFirst()

[](#x_string-upperfirst)

#### $x\_string-&gt;ucwords()

[](#x_string-ucwords)

#### $x\_string-&gt;capitalize()

[](#x_string-capitalize)

#### $x\_string-&gt;capitalizeWords()

[](#x_string-capitalizewords)

#### $x\_string-&gt;replace($old, $new)

[](#x_string-replaceold-new)

#### $x\_string-&gt;replaceAndCount($old, $new)

[](#x_string-replaceandcountold-new)

#### $x\_string-&gt;iReplace($old, $new)

[](#x_string-ireplaceold-new)

#### $x\_string-&gt;iReplaceAndCount($old, $new)

[](#x_string-ireplaceandcountold-new)

#### $x\_string-&gt;replaceMultiple($pairs)

[](#x_string-replacemultiplepairs)

#### $x\_string-&gt;translate($old, $new)

[](#x_string-translateold-new)

#### $x\_string-&gt;substring($offset, $length = null)

[](#x_string-substringoffset-length--null)

#### $x\_string-&gt;replaceSubstring($new, $offset, $length = null)

[](#x_string-replacesubstringnew-offset-length--null)

#### $x\_string-&gt;slice($i, $j = null)

[](#x_string-slicei-j--null)

#### $x\_string-&gt;replaceSlice($new, $i, $j = null)

[](#x_string-replaceslicenew-i-j--null)

#### $x\_string-&gt;insert($new, $offset)

[](#x_string-insertnew-offset)

#### $x\_string-&gt;pad($n, $pad = ' ')

[](#x_string-padn-pad---)

#### $x\_string-&gt;lpad($n, $pad = ' ')

[](#x_string-lpadn-pad---)

#### $x\_string-&gt;rpad($n, $pad = ' ')

[](#x_string-rpadn-pad---)

#### $x\_string-&gt;wrap($cols, $sep = "\\n")

[](#x_string-wrapcols-sep--n)

#### $x\_string-&gt;repeat($n)

[](#x_string-repeatn)

#### $x\_string-&gt;reverse()

[](#x_string-reverse)

#### $x\_string-&gt;startingWith($substr)

[](#x_string-startingwithsubstr)

#### $x\_string-&gt;iStartingWith($substr)

[](#x_string-istartingwithsubstr)

#### $x\_string-&gt;rStartingWith($char)

[](#x_string-rstartingwithchar)

#### $x\_string-&gt;startingWithChars($chars)

[](#x_string-startingwithcharschars)

#### $x\_string-&gt;preceding($substr)

[](#x_string-precedingsubstr)

#### $x\_string-&gt;iPreceding($substr)

[](#x_string-iprecedingsubstr)

#### $x\_string-&gt;words($chars = null)

[](#x_string-wordschars--null)

#### $x\_string-&gt;wordCount($chars = null)

[](#x_string-wordcountchars--null)

#### $x\_string-&gt;findWords($chars = null)

[](#x_string-findwordschars--null)

#### $x\_string-&gt;wordWrap($width, $sep = "\\n")

[](#x_string-wordwrapwidth-sep--n)

#### $x\_string-&gt;compare($that)

[](#x_string-comparethat)

#### $x\_string-&gt;iCompare($that)

[](#x_string-icomparethat)

#### $x\_string-&gt;nCompare($that, $n)

[](#x_string-ncomparethat-n)

#### $x\_string-&gt;inCompare($that, $n)

[](#x_string-incomparethat-n)

#### $x\_string-&gt;localeCompare($that)

[](#x_string-localecomparethat)

#### $x\_string-&gt;humanCompare($that)

[](#x_string-humancomparethat)

#### $x\_string-&gt;iHumanCompare($that)

[](#x_string-ihumancomparethat)

#### $x\_string-&gt;substringCompare($that, $offset, $length)

[](#x_string-substringcomparethat-offset-length)

#### $x\_string-&gt;iSubstringCompare($that, $offset, $length)

[](#x_string-isubstringcomparethat-offset-length)

#### $x\_string-&gt;contains($substr, $offset = 0)

[](#x_string-containssubstr-offset--0)

#### $x\_string-&gt;iContains($substr, $offset = 0)

[](#x_string-icontainssubstr-offset--0)

#### $x\_string-&gt;containsChars($chars)

[](#x_string-containscharschars)

#### $x\_string-&gt;containsChar($char)

[](#x_string-containscharchar)

#### $x\_string-&gt;beginsWith($prefix)

[](#x_string-beginswithprefix)

#### $x\_string-&gt;iBeginsWith($prefix)

[](#x_string-ibeginswithprefix)

#### $x\_string-&gt;endsWith($suffix)

[](#x_string-endswithsuffix)

#### $x\_string-&gt;iEndsWith($suffix)

[](#x_string-iendswithsuffix)

#### $x\_string-&gt;removePrefix($prefix)

[](#x_string-removeprefixprefix)

#### $x\_string-&gt;iRemovePrefix($prefix)

[](#x_string-iremoveprefixprefix)

#### $x\_string-&gt;removeSuffix($suffix)

[](#x_string-removesuffixsuffix)

#### $x\_string-&gt;iRemoveSuffix($suffix)

[](#x_string-iremovesuffixsuffix)

#### $x\_string-&gt;find($substr, $offset = 0)

[](#x_string-findsubstr-offset--0)

#### $x\_string-&gt;iFind($substr, $offset = 0)

[](#x_string-ifindsubstr-offset--0)

#### $x\_string-&gt;rFind($substr, $offset = 0)

[](#x_string-rfindsubstr-offset--0)

#### $x\_string-&gt;before($substr)

[](#x_string-beforesubstr)

#### $x\_string-&gt;after($substr)

[](#x_string-aftersubstr)

#### $x\_string-&gt;isLower()

[](#x_string-islower)

#### $x\_string-&gt;isUpper()

[](#x_string-isupper)

#### $x\_string-&gt;isAlphanumeric()

[](#x_string-isalphanumeric)

#### $x\_string-&gt;isAlphabetic()

[](#x_string-isalphabetic)

#### $x\_string-&gt;isControl()

[](#x_string-iscontrol)

#### $x\_string-&gt;isDecimal()

[](#x_string-isdecimal)

#### $x\_string-&gt;isHex()

[](#x_string-ishex)

#### $x\_string-&gt;isVisible()

[](#x_string-isvisible)

#### $x\_string-&gt;isPrintable()

[](#x_string-isprintable)

#### $x\_string-&gt;isPunctuation()

[](#x_string-ispunctuation)

#### $x\_string-&gt;isWhitespace()

[](#x_string-iswhitespace)

#### $x\_string-&gt;count($substr, $offset = 0, $length = null)

[](#x_string-countsubstr-offset--0-length--null)

#### $x\_string-&gt;characterRun($chars, $begin = 0, $end = null)

[](#x_string-characterrunchars-begin--0-end--null)

#### $x\_string-&gt;escapeCString()

[](#x_string-escapecstring)

#### $x\_string-&gt;unescapeCString()

[](#x_string-unescapecstring)

#### $x\_string-&gt;escapePhpString()

[](#x_string-escapephpstring)

#### $x\_string-&gt;unescapeBackslashes()

[](#x_string-unescapebackslashes)

#### $x\_string-&gt;parseInt($base = null)

[](#x_string-parseintbase--null)

#### $x\_string-&gt;parseReal()

[](#x_string-parsereal)

#### $x\_string-&gt;encodeHex()

[](#x_string-encodehex)

#### $x\_string-&gt;decodeHex()

[](#x_string-decodehex)

#### $x\_string-&gt;encodeBase64()

[](#x_string-encodebase64)

#### $x\_string-&gt;decodeBase64()

[](#x_string-decodebase64)

#### XString::fromAscii($n)

[](#xstringfromasciin)

#### XString::chr($n)

[](#xstringchrn)

#### $x\_string-&gt;toAscii()

[](#x_string-toascii)

#### $x\_string-&gt;ord()

[](#x_string-ord)

#### $x\_string-&gt;byteCounts()

[](#x_string-bytecounts)

#### $x\_string-&gt;unique()

[](#x_string-unique)

#### $x\_string-&gt;unusedBytes()

[](#x_string-unusedbytes)

#### $x\_string-&gt;encodeHtml($noquote = false)

[](#x_string-encodehtmlnoquote--false)

#### $x\_string-&gt;escapeHtml($noquote = false)

[](#x_string-escapehtmlnoquote--false)

#### $x\_string-&gt;unencodeHtml()

[](#x_string-unencodehtml)

#### XString::encodeHtmlDict($noquote = false)

[](#xstringencodehtmldictnoquote--false)

#### $x\_string-&gt;encodeHtmlEntities()

[](#x_string-encodehtmlentities)

#### XString::encodeHtmlEntitiesDict()

[](#xstringencodehtmlentitiesdict)

#### $x\_string-&gt;stripTags()

[](#x_string-striptags)

#### $x\_string-&gt;parseRawQueryString()

[](#x_string-parserawquerystring)

#### XString::encodeStandardQueryString($data, $sep = '&amp;')

[](#xstringencodestandardquerystringdata-sep--)

#### XString::encodeQueryString($data, $sep = '&amp;')

[](#xstringencodequerystringdata-sep--)

#### $x\_string-&gt;encodeStandardUrl()

[](#x_string-encodestandardurl)

#### $x\_string-&gt;decodeStandardUrl()

[](#x_string-decodestandardurl)

#### $x\_string-&gt;encodeUrl()

[](#x_string-encodeurl)

#### $x\_string-&gt;decodeUrl()

[](#x_string-decodeurl)

#### $x\_string-&gt;parseCsv($delim = ',', $quote = '"', $escape = '\\\\')

[](#x_string-parsecsvdelim---quote---escape--)

#### $x\_string-&gt;md5()

[](#x_string-md5)

#### $x\_string-&gt;md5Hex()

[](#x_string-md5hex)

#### $x\_string-&gt;sha1()

[](#x_string-sha1)

#### $x\_string-&gt;sha1Hex()

[](#x_string-sha1hex)

#### $x\_string-&gt;rot13()

[](#x_string-rot13)

#### $x\_string-&gt;shuffle()

[](#x_string-shuffle)

#### $x\_string-&gt;formatMoney()

[](#x_string-formatmoney)

#### XString::formatNumber($number, $decimals = 0, $decimal\_point = '.', $thousands\_sep = ',')

[](#xstringformatnumbernumber-decimals--0-decimal_point---thousands_sep--)

#### $x\_string-&gt;levenshtein($that, $ins = null, $repl = null, $del = null)

[](#x_string-levenshteinthat-ins--null-repl--null-del--null)

#### $x\_string-&gt;splitCamelCase()

[](#x_string-splitcamelcase)

#### $x\_string-&gt;pluralize()

[](#x_string-pluralize)

#### XString::capture($callback)

[](#xstringcapturecallback)

### class Jitsu\\XArray

[](#class-jitsuxarray)

An object-oriented wrapper class for the `array` type.

See [jitsu/array](https://github.com/bdusell/jitsu-array).

#### new XArray($value = array())

[](#new-xarrayvalue--array)

Type**`$value`**`array#### $x\_array-&gt;\_\_toString()

[](#x_array-__tostring)

Typereturns`string`#### $x\_array-&gt;count()

[](#x_array-count)

#### $x\_array-&gt;getIterator()

[](#x_array-getiterator)

#### $x\_array-&gt;offsetExists($offset)

[](#x_array-offsetexistsoffset)

#### $x\_array-&gt;offsetGet($offset)

[](#x_array-offsetgetoffset)

#### $x\_array-&gt;offsetSet($offset, $value)

[](#x_array-offsetsetoffset-value)

#### $x\_array-&gt;offsetUnset($offset)

[](#x_array-offsetunsetoffset)

#### XArray::unwrap($x)

[](#xarrayunwrapx)

#### $x\_array-&gt;join($str = '')

[](#x_array-joinstr--)

#### $x\_array-&gt;size()

[](#x_array-size)

#### $x\_array-&gt;length()

[](#x_array-length)

#### $x\_array-&gt;isEmpty()

[](#x_array-isempty)

#### $x\_array-&gt;get($key, $default = null)

[](#x_array-getkey-default--null)

#### $x\_array-&gt;getRef($key, $default = null)

[](#x_array-getrefkey-default--null)

#### $x\_array-&gt;hasKey($key)

[](#x_array-haskeykey)

#### XArray::normalizeKey($k)

[](#xarraynormalizekeyk)

#### $x\_array-&gt;remove($key)

[](#x_array-removekey)

#### $x\_array-&gt;keys()

[](#x_array-keys)

#### $x\_array-&gt;values()

[](#x_array-values)

#### $x\_array-&gt;listValues($keys, $default = null)

[](#x_array-listvalueskeys-default--null)

#### $x\_array-&gt;requireValues($keys)

[](#x_array-requirevalueskeys)

#### $x\_array-&gt;first()

[](#x_array-first)

#### $x\_array-&gt;last()

[](#x_array-last)

#### $x\_array-&gt;append($value)

[](#x_array-appendvalue)

#### $x\_array-&gt;appendMany($values)

[](#x_array-appendmanyvalues)

#### $x\_array-&gt;concat($array)

[](#x_array-concatarray)

#### $x\_array-&gt;push($value)

[](#x_array-pushvalue)

#### $x\_array-&gt;pop()

[](#x_array-pop)

#### $x\_array-&gt;shift()

[](#x_array-shift)

#### $x\_array-&gt;unshift($value)

[](#x_array-unshiftvalue)

#### $x\_array-&gt;keyOf($value)

[](#x_array-keyofvalue)

#### $x\_array-&gt;indexOf($value)

[](#x_array-indexofvalue)

#### $x\_array-&gt;keysOf($value)

[](#x_array-keysofvalue)

#### $x\_array-&gt;contains($value)

[](#x_array-containsvalue)

#### $x\_array-&gt;at($i)

[](#x_array-ati)

#### $x\_array-&gt;pairAt($i)

[](#x_array-pairati)

#### $x\_array-&gt;keyAt($i)

[](#x_array-keyati)

#### $x\_array-&gt;slice($i, $j = null)

[](#x_array-slicei-j--null)

#### $x\_array-&gt;pairSlice($i, $j = null)

[](#x_array-pairslicei-j--null)

#### $x\_array-&gt;assignSlice($sub, $i, $j = null)

[](#x_array-assignslicesub-i-j--null)

#### $x\_array-&gt;removeSlice($i, $j = null)

[](#x_array-removeslicei-j--null)

#### $x\_array-&gt;reverse()

[](#x_array-reverse)

#### $x\_array-&gt;reversePairs()

[](#x_array-reversepairs)

#### XArray::range($i, $j = null, $step = 1)

[](#xarrayrangei-j--null-step--1)

#### XArray::fromPairs($pairs)

[](#xarrayfrompairspairs)

#### XArray::fromLists($keys, $values)

[](#xarrayfromlistskeys-values)

#### $x\_array-&gt;toSet($value = true)

[](#x_array-tosetvalue--true)

#### XArray::fill($value, $n)

[](#xarrayfillvalue-n)

#### $x\_array-&gt;pad($value, $n)

[](#x_array-padvalue-n)

#### $x\_array-&gt;pluck($key)

[](#x_array-pluckkey)

#### $x\_array-&gt;pick($keys)

[](#x_array-pickkeys)

#### $x\_array-&gt;getPick($keys, $default = null)

[](#x_array-getpickkeys-default--null)

#### $x\_array-&gt;invert()

[](#x_array-invert)

#### $x\_array-&gt;extend($array)

[](#x_array-extendarray)

#### $x\_array-&gt;deepExtend($array)

[](#x_array-deepextendarray)

#### $x\_array-&gt;chunks($n)

[](#x_array-chunksn)

#### $x\_array-&gt;map($callback)

[](#x_array-mapcallback)

#### $x\_array-&gt;filter($callback = null)

[](#x_array-filtercallback--null)

#### $x\_array-&gt;filterPairs($callback)

[](#x_array-filterpairscallback)

#### $x\_array-&gt;sum()

[](#x_array-sum)

#### $x\_array-&gt;product()

[](#x_array-product)

#### $x\_array-&gt;reduce($callback, $initial = null)

[](#x_array-reducecallback-initial--null)

#### $x\_array-&gt;apply($callback)

[](#x_array-applycallback)

#### $x\_array-&gt;traverseLeaves($callback)

[](#x_array-traverseleavescallback)

#### $x\_array-&gt;difference($array, $key\_cmp = null, $value\_cmp = true)

[](#x_array-differencearray-key_cmp--null-value_cmp--true)

#### $x\_array-&gt;pairDifference($array, $key\_cmp = null, $value\_cmp = null)

[](#x_array-pairdifferencearray-key_cmp--null-value_cmp--null)

#### $x\_array-&gt;keyDifference($array, $key\_cmp = null)

[](#x_array-keydifferencearray-key_cmp--null)

#### $x\_array-&gt;valueDifference($array, $value\_cmp = null)

[](#x_array-valuedifferencearray-value_cmp--null)

#### $x\_array-&gt;pairIntersection($array, $key\_cmp = null, $value\_cmp = null)

[](#x_array-pairintersectionarray-key_cmp--null-value_cmp--null)

#### $x\_array-&gt;keyIntersection($array, $key\_cmp = null)

[](#x_array-keyintersectionarray-key_cmp--null)

#### $x\_array-&gt;valueIntersection($array, $value\_cmp = null)

[](#x_array-valueintersectionarray-value_cmp--null)

#### $x\_array-&gt;uniqueValues()

[](#x_array-uniquevalues)

#### $x\_array-&gt;hasOnlyKeys($keys, &amp;$unexpected = null)

[](#x_array-hasonlykeyskeys-unexpected--null)

#### $x\_array-&gt;hasKeys($keys, &amp;$missing = null)

[](#x_array-haskeyskeys-missing--null)

#### $x\_array-&gt;hasExactKeys($keys, &amp;$unexpected = null, &amp;$missing = null)

[](#x_array-hasexactkeyskeys-unexpected--null-missing--null)

#### $x\_array-&gt;randomKey()

[](#x_array-randomkey)

#### $x\_array-&gt;randomValue()

[](#x_array-randomvalue)

#### $x\_array-&gt;randomPair()

[](#x_array-randompair)

#### $x\_array-&gt;randomKeys($n)

[](#x_array-randomkeysn)

#### $x\_array-&gt;shuffle()

[](#x_array-shuffle)

#### $x\_array-&gt;sort($value\_cmp = null)

[](#x_array-sortvalue_cmp--null)

#### $x\_array-&gt;reverseSort()

[](#x_array-reversesort)

#### $x\_array-&gt;localeSort()

[](#x_array-localesort)

#### $x\_array-&gt;sortPairs($value\_cmp = null)

[](#x_array-sortpairsvalue_cmp--null)

#### $x\_array-&gt;reverseSortPairs()

[](#x_array-reversesortpairs)

#### $x\_array-&gt;sortKeys($key\_cmp = null)

[](#x_array-sortkeyskey_cmp--null)

#### $x\_array-&gt;reverseSortKeys()

[](#x_array-reversesortkeys)

#### $x\_array-&gt;humanSortValues()

[](#x_array-humansortvalues)

#### $x\_array-&gt;iHumanSortValues()

[](#x_array-ihumansortvalues)

#### $x\_array-&gt;lowerKeys()

[](#x_array-lowerkeys)

#### $x\_array-&gt;upperKeys()

[](#x_array-upperkeys)

#### $x\_array-&gt;isSequential()

[](#x_array-issequential)

#### $x\_array-&gt;isAssociative()

[](#x_array-isassociative)

#### $x\_array-&gt;looksSequential()

[](#x_array-lookssequential)

#### $x\_array-&gt;looksAssociative()

[](#x_array-looksassociative)

#### $x\_array-&gt;countValues()

[](#x_array-countvalues)

### class Jitsu\\XRegex

[](#class-jitsuxregex)

An object-oriented wrapper for PHP's PCRE patterns.

See [jitsu/regex](https://github.com/bdusell/jitsu-regex).

#### new XRegex($arg, $flags = '', $start = null, $end = null)

[](#new-xregexarg-flags---start--null-end--null)

TypeDescription**`$arg`**`string\\Jitsu\\XString**`$flags`**`string\\Jitsu\\XString`**`$start`**`string\\Jitsu\\XString**`$start`**`string\\Jitsu\\XString#### $x\_regex-&gt;\_\_toString()

[](#x_regex-__tostring)

#### $x\_regex-&gt;match($str, $offset = 0)

[](#x_regex-matchstr-offset--0)

#### $x\_regex-&gt;matchWithOffsets($str, $offset = 0)

[](#x_regex-matchwithoffsetsstr-offset--0)

#### $x\_regex-&gt;matchAll($str, $offset = 0)

[](#x_regex-matchallstr-offset--0)

#### $x\_regex-&gt;matchAllWithOffsets($str, $offset = 0)

[](#x_regex-matchallwithoffsetsstr-offset--0)

#### XRegex::escape($str, $delim = null)

[](#xregexescapestr-delim--null)

#### $x\_regex-&gt;replace($str, $replacement, $limit = null)

[](#x_regex-replacestr-replacement-limit--null)

#### $x\_regex-&gt;replaceAndCount($str, $replacement, $limit = null)

[](#x_regex-replaceandcountstr-replacement-limit--null)

#### $x\_regex-&gt;replaceWith($str, $callback, $limit = null)

[](#x_regex-replacewithstr-callback-limit--null)

#### $x\_regex-&gt;replaceAndCountWith($str, $callback, $limit = null)

[](#x_regex-replaceandcountwithstr-callback-limit--null)

#### $x\_regex-&gt;replaceAndFilter($str, $replacement, $limit = null)

[](#x_regex-replaceandfilterstr-replacement-limit--null)

#### $x\_regex-&gt;replaceAndFilterAndCount($str, $replacement, $limit = null)

[](#x_regex-replaceandfilterandcountstr-replacement-limit--null)

#### $x\_regex-&gt;grep($strs)

[](#x_regex-grepstrs)

#### $x\_regex-&gt;invertedGrep($strs)

[](#x_regex-invertedgrepstrs)

#### $x\_regex-&gt;split($str, $limit = null)

[](#x_regex-splitstr-limit--null)

#### $x\_regex-&gt;splitWithOffsets($str, $limit = null)

[](#x_regex-splitwithoffsetsstr-limit--null)

#### $x\_regex-&gt;splitAndFilter($str, $limit = null)

[](#x_regex-splitandfilterstr-limit--null)

#### $x\_regex-&gt;splitAndFilterWithOffsets($str, $limit = null)

[](#x_regex-splitandfilterwithoffsetsstr-limit--null)

#### $x\_regex-&gt;inclusiveSplit($str, $limit = null)

[](#x_regex-inclusivesplitstr-limit--null)

#### $x\_regex-&gt;inclusiveSplitWithOffsets($str, $limit = null)

[](#x_regex-inclusivesplitwithoffsetsstr-limit--null)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~116 days

Total

3

Last Release

3664d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cca83b66140c874bd446e8cfb132f5c1d4e4747a2a58f465b47d2b618e27ff1c?d=identicon)[bdusell](/maintainers/bdusell)

---

Top Contributors

[![bdusell](https://avatars.githubusercontent.com/u/5336190?v=4)](https://github.com/bdusell "bdusell (10 commits)")

---

Tags

arraymethod-chainingoopphpregexregular-expressionstringweb-developmentarraystringutilityregexwrapperpregchaining

### Embed Badge

![Health badge](/badges/jitsu-wrap/health.svg)

```
[![Health](https://phpackages.com/badges/jitsu-wrap/health.svg)](https://phpackages.com/packages/jitsu-wrap)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.0M191](/packages/danielstjules-stringy)[composer/pcre

PCRE wrapping library that offers type-safe preg\_\* replacements.

699313.8M34](/packages/composer-pcre)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4875.5M16](/packages/voku-arrayy)[bocharsky-bw/arrayzy

A native PHP arrays easy manipulation library in OOP way.

38425.4k](/packages/bocharsky-bw-arrayzy)[voku/stringy

A string manipulation library with multibyte support

1783.8M19](/packages/voku-stringy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
