Download the PHP package yiisoft/strings without Composer
On this page you can find all versions of the php package yiisoft/strings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yiisoft/strings
More information about yiisoft/strings
Files in yiisoft/strings
Package strings
Short Description Yii Strings Helper
License BSD-3-Clause
Homepage https://www.yiiframework.com/
Informations about the package strings
Yii Strings
The package provides:
StringHelper
that has static methods to work with strings;NumericHelper
that has static methods to work with numeric strings;Inflector
provides methods such astoPlural()
ortoSlug()
that derive a new string based on the string given;WildcardPattern
is a shell wildcard pattern to match strings against;CombinedRegexp
is a wrapper that optimizes multiple regular expressions matching andMemoizedCombinedRegexp
is a decorator that caches results ofCombinedRegexp
to speed up matching.
Requirements
- PHP 8.0 or higher.
mbstring
PHP extension.
Installation
The package could be installed with Composer:
StringHelper usage
String helper methods are static so usage is like the following:
Overall the helper has the following method groups.
Bytes
- byteLength
- byteSubstring
File paths
- baseName
- directoryName
Substrings
- substring
- replaceSubstring
- startsWith
- startsWithIgnoringCase
- endsWith
- endsWithIgnoringCase
- findBetween
- findBetweenFirst
- findBetweenLast
Truncation
- truncateBegin
- truncateMiddle
- truncateEnd
- truncateWords
- trim
- ltrim
- rtrim
Counting
- length
- countWords
Lowercase and uppercase
- lowercase
- uppercase
- uppercaseFirstCharacter
- uppercaseFirstCharacterInEachWord
URL friendly base64
- base64UrlEncode
- base64UrlDecode
Other
- parsePath
- split
NumericHelper usage
Numeric helper methods are static so usage is like the following:
The following methods are available:
- toOrdinal
- normalize
- isInteger
Inflector usage
Overall the inflector has the following method groups.
Plurals and singulars
- toPlural
- toSingular
Transliteration
- toTransliterated
Case conversion
- pascalCaseToId
- toPascalCase
- toCamelCase
Words and sentences
- toSentence
- toWords
- toHumanReadable
Classes and database tables
- classToTable
- tableToClass
URLs
- toSlug
WildcardPattern usage
WildcardPattern
allows a simple POSIX-style string matching.
The following characters are special in the pattern:
\
escapes other special characters if usage of escape character is not turned off.*
matches any string, including the empty string, except delimiters (/
and\
by default).**
matches any string, including the empty string and delimiters.?
matches any single character.[seq]
matches any character in seq.[a-z]
matches any character from a to z.[!seq]
matches any character not in seq.[[:alnum:]]
matches POSIX style character classes.
ignoreCase()
could be called before doing a match()
to get a case-insensitive match:
CombinedRegexp usage
CombinedRegexp
optimizes matching multiple regular expressions.
MemoizedCombinedRegexp usage
MemoizedCombinedRegexp
caches results of CombinedRegexp
in memory.
It is useful when the same incoming string are matching multiple times or different methods of CombinedRegexp
are called.
Documentation
- Internals
If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.
License
The Yii Strings is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.
Support the project
Follow updates
All versions of strings with dependencies
ext-mbstring Version *