Download the PHP package php-filter/string without Composer
On this page you can find all versions of the php package php-filter/string. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download php-filter/string
More information about php-filter/string
Files in php-filter/string
Package string
Short Description Take advantage of the ability to filter thongs with a filter chain.
License MIT
Informations about the package string
PHP String Filters
PHP String Filter is a library to perform character string transformation using a chain. You can use the most popular filters built into PHP and additional ones added by the author and community.
Support the following input data types: string, integer, float, boolean, null and object (must have a __toString method) Support the following output data types: string, int, float, bool and stringOrNull, intOrNull, floatOrNull
Installation
Install in your projects:
And use:
Filter list:
| Filter | Input | Output |
|---|---|---|
| alnum() | LLeMs!ZaF_F3dEX 4 |
LLeMsZaFF3dEX4 |
| alnumWith('_') | LLeMs!$%ZaF_F3dEX 4 |
LLeMsZaF_F3dEX4 |
| append('Smith') | John |
JohnSmith |
| camelize() | primary-getallgroups-sys |
primaryGetallgroupsSys |
extractBetween('<div>', '</div>') |
<div>test</div> |
test |
| htmlSpecialCharsDecode() | <a href="test">Test</a> |
<a href="test">Test</a> |
| htmlSpecialChars() | <a href="test">Test</a> |
<a href="test">Test</a> |
| letter() | girl_123 |
girl |
| letterWith('_') | girl_123! |
girl_ |
| limit(4) | this is |
this |
| lowerFirst() | Big Ben |
big Ben |
| lower() | Lucy Brown |
lucy brown |
| numeric() | a123 |
123 |
| numericWith('.') | 10.31 zl |
10.31 |
| prepend('John ') | Smith |
JohnSmith |
| removeMultipleSpaces() | Replacing multiple spaces |
Replacing multiple spaces |
| remove(' Up Front') | Big Design Up Front |
Big Design |
| repeat(3) | test |
testtesttest |
| replaceRegex('/[^a-zA-Z0-9]/', '') | Big-Design-Up-Front |
BigDesignUpFront |
| replace('Design Up Front', 'Ball Of Mud') | Big Design Up Front |
Big Ball Of Mud |
| reverse() | test |
tset |
| shuffle() | test |
tset |
stripHtml('<b>') |
<u><b>test</b></u> |
dsadsa |
| strPadLeft(12, '0'); | 2/10/2020 |
0002/10/2020 |
| strPadRight(12, '0'); | 0002/10/2 |
0002/10/2000 |
| substr(0, 4); | test 123 |
test |
| trimLeft('.') | .test |
test |
| trimRight('.') | test. |
test |
| trim() | test |
test |
| upperFirst() | lucy |
Lucy |
| upper() | lucy Brown |
LUCY BROWN |
| upperWords() | lucy lue |
Lucy Lue |
wordWrap(3, '</br>') |
Big Design Up Front |
Big</br>Design</br>Up</br>Front |
Filter example:
For a list of filters and more examples of their application, see unit tests.
An example of a reusable filter grouping:
Example value output:
Example of value information:
Roadmap
- [x] Description of all filters with examples
- [ ] Add more filters
- [ ] You tell me...
License
PHP String Filters is released under the MIT License. See the bundled LICENSE file for details.
Author
All versions of string with dependencies
ext-iconv Version *