Download the PHP package jitsu/wrap without Composer
On this page you can find all versions of the php package jitsu/wrap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wrap
jitsu/wrap
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.
Installation
Install this package with Composer:
Namespace
All classes are defined under the namespace Jitsu
.
Usage
Here's a quick example to illustrate this package's tremendous usefulness:
API
class Jitsu\XString
An object-oriented wrapper for the string
type.
See jitsu/string.
new XString($value = '')
Type | |
---|---|
$value |
string|self |
$x_string->__toString()
XString::unwrap($x)
$x_string->length()
$x_string->size()
$x_string->isEmpty()
$x_string->equal($that)
$x_string->iEqual($that)
$x_string->chars()
$x_string->chunks($n)
$x_string->split($delim = null, $limit = null)
$x_string->tokenize($chars)
$x_string->join($strs = null)
$x_string->trim($chars = null)
$x_string->rtrim($chars = null)
$x_string->ltrim($chars = null)
$x_string->lower()
$x_string->upper()
$x_string->lcfirst()
$x_string->lowerFirst()
$x_string->ucfirst()
$x_string->upperFirst()
$x_string->ucwords()
$x_string->capitalize()
$x_string->capitalizeWords()
$x_string->replace($old, $new)
$x_string->replaceAndCount($old, $new)
$x_string->iReplace($old, $new)
$x_string->iReplaceAndCount($old, $new)
$x_string->replaceMultiple($pairs)
$x_string->translate($old, $new)
$x_string->substring($offset, $length = null)
$x_string->replaceSubstring($new, $offset, $length = null)
$x_string->slice($i, $j = null)
$x_string->replaceSlice($new, $i, $j = null)
$x_string->insert($new, $offset)
$x_string->pad($n, $pad = ' ')
$x_string->lpad($n, $pad = ' ')
$x_string->rpad($n, $pad = ' ')
$x_string->wrap($cols, $sep = "\n")
$x_string->repeat($n)
$x_string->reverse()
$x_string->startingWith($substr)
$x_string->iStartingWith($substr)
$x_string->rStartingWith($char)
$x_string->startingWithChars($chars)
$x_string->preceding($substr)
$x_string->iPreceding($substr)
$x_string->words($chars = null)
$x_string->wordCount($chars = null)
$x_string->findWords($chars = null)
$x_string->wordWrap($width, $sep = "\n")
$x_string->compare($that)
$x_string->iCompare($that)
$x_string->nCompare($that, $n)
$x_string->inCompare($that, $n)
$x_string->localeCompare($that)
$x_string->humanCompare($that)
$x_string->iHumanCompare($that)
$x_string->substringCompare($that, $offset, $length)
$x_string->iSubstringCompare($that, $offset, $length)
$x_string->contains($substr, $offset = 0)
$x_string->iContains($substr, $offset = 0)
$x_string->containsChars($chars)
$x_string->containsChar($char)
$x_string->beginsWith($prefix)
$x_string->iBeginsWith($prefix)
$x_string->endsWith($suffix)
$x_string->iEndsWith($suffix)
$x_string->removePrefix($prefix)
$x_string->iRemovePrefix($prefix)
$x_string->removeSuffix($suffix)
$x_string->iRemoveSuffix($suffix)
$x_string->find($substr, $offset = 0)
$x_string->iFind($substr, $offset = 0)
$x_string->rFind($substr, $offset = 0)
$x_string->before($substr)
$x_string->after($substr)
$x_string->isLower()
$x_string->isUpper()
$x_string->isAlphanumeric()
$x_string->isAlphabetic()
$x_string->isControl()
$x_string->isDecimal()
$x_string->isHex()
$x_string->isVisible()
$x_string->isPrintable()
$x_string->isPunctuation()
$x_string->isWhitespace()
$x_string->count($substr, $offset = 0, $length = null)
$x_string->characterRun($chars, $begin = 0, $end = null)
$x_string->escapeCString()
$x_string->unescapeCString()
$x_string->escapePhpString()
$x_string->unescapeBackslashes()
$x_string->parseInt($base = null)
$x_string->parseReal()
$x_string->encodeHex()
$x_string->decodeHex()
$x_string->encodeBase64()
$x_string->decodeBase64()
XString::fromAscii($n)
XString::chr($n)
$x_string->toAscii()
$x_string->ord()
$x_string->byteCounts()
$x_string->unique()
$x_string->unusedBytes()
$x_string->encodeHtml($noquote = false)
$x_string->escapeHtml($noquote = false)
$x_string->unencodeHtml()
XString::encodeHtmlDict($noquote = false)
$x_string->encodeHtmlEntities()
XString::encodeHtmlEntitiesDict()
$x_string->stripTags()
$x_string->parseRawQueryString()
XString::encodeStandardQueryString($data, $sep = '&')
XString::encodeQueryString($data, $sep = '&')
$x_string->encodeStandardUrl()
$x_string->decodeStandardUrl()
$x_string->encodeUrl()
$x_string->decodeUrl()
$x_string->parseCsv($delim = ',', $quote = '"', $escape = '\\')
$x_string->md5()
$x_string->md5Hex()
$x_string->sha1()
$x_string->sha1Hex()
$x_string->rot13()
$x_string->shuffle()
$x_string->formatMoney()
XString::formatNumber($number, $decimals = 0, $decimal_point = '.', $thousands_sep = ',')
$x_string->levenshtein($that, $ins = null, $repl = null, $del = null)
$x_string->splitCamelCase()
$x_string->pluralize()
XString::capture($callback)
class Jitsu\XArray
An object-oriented wrapper class for the array
type.
See jitsu/array.
new XArray($value = array())
Type | |
---|---|
$value |
array|self |
$x_array->__toString()
Type | |
---|---|
returns | string |
$x_array->count()
$x_array->getIterator()
$x_array->offsetExists($offset)
$x_array->offsetGet($offset)
$x_array->offsetSet($offset, $value)
$x_array->offsetUnset($offset)
XArray::unwrap($x)
$x_array->join($str = '')
$x_array->size()
$x_array->length()
$x_array->isEmpty()
$x_array->get($key, $default = null)
$x_array->getRef($key, $default = null)
$x_array->hasKey($key)
XArray::normalizeKey($k)
$x_array->remove($key)
$x_array->keys()
$x_array->values()
$x_array->listValues($keys, $default = null)
$x_array->requireValues($keys)
$x_array->first()
$x_array->last()
$x_array->append($value)
$x_array->appendMany($values)
$x_array->concat($array)
$x_array->push($value)
$x_array->pop()
$x_array->shift()
$x_array->unshift($value)
$x_array->keyOf($value)
$x_array->indexOf($value)
$x_array->keysOf($value)
$x_array->contains($value)
$x_array->at($i)
$x_array->pairAt($i)
$x_array->keyAt($i)
$x_array->slice($i, $j = null)
$x_array->pairSlice($i, $j = null)
$x_array->assignSlice($sub, $i, $j = null)
$x_array->removeSlice($i, $j = null)
$x_array->reverse()
$x_array->reversePairs()
XArray::range($i, $j = null, $step = 1)
XArray::fromPairs($pairs)
XArray::fromLists($keys, $values)
$x_array->toSet($value = true)
XArray::fill($value, $n)
$x_array->pad($value, $n)
$x_array->pluck($key)
$x_array->pick($keys)
$x_array->getPick($keys, $default = null)
$x_array->invert()
$x_array->extend($array)
$x_array->deepExtend($array)
$x_array->chunks($n)
$x_array->map($callback)
$x_array->filter($callback = null)
$x_array->filterPairs($callback)
$x_array->sum()
$x_array->product()
$x_array->reduce($callback, $initial = null)
$x_array->apply($callback)
$x_array->traverseLeaves($callback)
$x_array->difference($array, $key_cmp = null, $value_cmp = true)
$x_array->pairDifference($array, $key_cmp = null, $value_cmp = null)
$x_array->keyDifference($array, $key_cmp = null)
$x_array->valueDifference($array, $value_cmp = null)
$x_array->pairIntersection($array, $key_cmp = null, $value_cmp = null)
$x_array->keyIntersection($array, $key_cmp = null)
$x_array->valueIntersection($array, $value_cmp = null)
$x_array->uniqueValues()
$x_array->hasOnlyKeys($keys, &$unexpected = null)
$x_array->hasKeys($keys, &$missing = null)
$x_array->hasExactKeys($keys, &$unexpected = null, &$missing = null)
$x_array->randomKey()
$x_array->randomValue()
$x_array->randomPair()
$x_array->randomKeys($n)
$x_array->shuffle()
$x_array->sort($value_cmp = null)
$x_array->reverseSort()
$x_array->localeSort()
$x_array->sortPairs($value_cmp = null)
$x_array->reverseSortPairs()
$x_array->sortKeys($key_cmp = null)
$x_array->reverseSortKeys()
$x_array->humanSortValues()
$x_array->iHumanSortValues()
$x_array->lowerKeys()
$x_array->upperKeys()
$x_array->isSequential()
$x_array->isAssociative()
$x_array->looksSequential()
$x_array->looksAssociative()
$x_array->countValues()
class Jitsu\XRegex
An object-oriented wrapper for PHP's PCRE patterns.
See jitsu/regex.
new XRegex($arg, $flags = '', $start = null, $end = null)
Type | Description | |
---|---|---|
$arg |
string|\Jitsu\XString|self |
Either a PCRE pattern or another XRegex . |
$flags |
string|\Jitsu\XString |
PCRE flags such as i , etc. |
$start |
string|\Jitsu\XString|null |
Optional starting delimiter for the escaped PCRE pattern stored in pattern . This might simplify the escaped pattern if, for example, it is known that the regular expression contains a lot of slashes. |
$start |
string|\Jitsu\XString|null |
Optional ending delimiter. Only necessary for bracket pairs. |
$x_regex->__toString()
$x_regex->match($str, $offset = 0)
$x_regex->matchWithOffsets($str, $offset = 0)
$x_regex->matchAll($str, $offset = 0)
$x_regex->matchAllWithOffsets($str, $offset = 0)
XRegex::escape($str, $delim = null)
$x_regex->replace($str, $replacement, $limit = null)
$x_regex->replaceAndCount($str, $replacement, $limit = null)
$x_regex->replaceWith($str, $callback, $limit = null)
$x_regex->replaceAndCountWith($str, $callback, $limit = null)
$x_regex->replaceAndFilter($str, $replacement, $limit = null)
$x_regex->replaceAndFilterAndCount($str, $replacement, $limit = null)
$x_regex->grep($strs)
$x_regex->invertedGrep($strs)
$x_regex->split($str, $limit = null)
$x_regex->splitWithOffsets($str, $limit = null)
$x_regex->splitAndFilter($str, $limit = null)
$x_regex->splitAndFilterWithOffsets($str, $limit = null)
$x_regex->inclusiveSplit($str, $limit = null)
$x_regex->inclusiveSplitWithOffsets($str, $limit = null)
All versions of wrap with dependencies
jitsu/string Version ^0.1.1
jitsu/array Version ^0.1.1
jitsu/regex Version ^0.1.1