Download the PHP package hipsterjazzbo/editor without Composer
On this page you can find all versions of the php package hipsterjazzbo/editor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hipsterjazzbo/editor
More information about hipsterjazzbo/editor
Files in hipsterjazzbo/editor
Package editor
Short Description A clean, elegant, unicode-safe, fluent, immutable, localisable, dependency-free string manipulation library for PHP 7.1+
License MIT
Informations about the package editor
Editor
A clean, elegant, unicode-safe, fluent, immutable, localisable, dependency-free string manipulation library for PHP 7.1+
Installation
You can install the package via composer:
Usage
Create an instance
To use Editor, first you've got to instantiate it on your string:
That's a little verbose though, so Editor comes with a global helper function too:
Do some stuff!
Editor is fluent and chainable, so you can just keep adding operations to each other:
Editor is also immutable, so you won't mess up your original instance:
Editor implements PHP's __toString()
magic method, so in most cases you can just use it like a string and it'll work just fine:
If you do need to get a regular string back for whatever reason, you can either cast an instance of Editor, or call str()
:
Title Casing
Editor implements proper title casing, based on John Gruber's crazy title casing script:
If you're after what other libraries so boldly claim is title case, you want upperCaseFirst()
:
Inflection
Editor supports making a string singular or plural:
Inflections are localizable in Editor. Right now, Editor supports 6 languages:
- English ('en')
- Spanish ('es')
- French ('fr')
- Portuguese ('pt')
- Norwegian Bokmal ('nb')
- Turkish ('tr')
If you'd like to add an inflector, simply
- Extend
Hipsterjazzbo\Editor\Inflectors\Inflector
- Register with
Editor::registerInflector($inflector)
- That's it!
If you do add inflectors, feel free to open a Pull Request!
Function Reference
Full function reference documentation is probably something I should write. But for now, you can peruse the main Editor class. Every method is doc-blocked and tested 👍
All versions of editor with dependencies
ext-mbstring Version *