Releases: PHLAK/Twine
Releases · PHLAK/Twine
v5.0.0
Changed
- Bumped minimum required PHP version to 8.1 and ensured support up to PHP v8.4
PHLAK\Twine\Strnow exposes$stringand$encodingaspublic readonlyproperties- Refacotored
PHLAK\Twine\Config\*classes to enums (usage remains unchanged) - Updated
PHLAK\Twine\Strobject serialization to use magic methodsPHLAK\Twine\Strno longerimplements Serializableserialize()andunserialize()methods replaced with__serialize()and__unserialize()respectively
4.2.0
Changed
- Added
ext-mbstringto the requirements incomposer.json - Minor internal tweaks
Detailed changelog: 4.1.0...4.2.0
4.1.0
Added
- Added
Str::match()method - Added
Str::matchAll()method
Changed
- Set the string's internal encoding on
Strobject creation
Fixed
- Encoding was not preserved when returning a new instance of the
Strclass from a method
Detailed changelog: 4.0.1...4.1.0
4.0.1
Fixed
- Added missing encoding declaration in
Str::uppercase() Str::make()now allows passing multiple parameters (i.e. encoding)
Detailed changelog: 4.0.0...4.0.1
4.0.0
Added
- Added
Str::chracters()method - Added
Str::chunk()method - Added
Str::encoding()method - Added
Str::explode()method - Added
Str::in()method - Added
Str::isEmpty()method - Added
Str::isNotEmpty()method - Added
Str::nth()method - Added
Str::split()method - Added
Str::to()method - Added Typable methods
Str::isAlphabetic()Str::isNumeric()Str::isAlphanumeric()Str::isLowercase()Str::isUppercase()Str::isWhitespace()Str::isPunctuation()Str::isPrintable()
Changed
Str::words()will now return an array ofTwine\Strobjects
Other
- Major improvements to multi-byte string support
- Allow defining a
Twine\Strobject's encoding- Do this on individual objects via the second parameter when newing up a
Twine\Strobject - Or set a global default by calling
Twine\Config\Str::setEncoding()before newing up an object
- Do this on individual objects via the second parameter when newing up a
Detailed changelog: 3.0.0...4.0.0
3.0.0
Added
- Added
Str::echo()method - Added
Str::from()method - Added
Str::matches()method - Added
Str::strip()method
Changed
- Twine now works with multi-byte strings
- Replaced
Str::urlencode()withStr::url() Str::replace()can now replace multiple parts of a string at onceStr::repeat()can now take a glue string as the second parameter- Renamed
InvalidConfigOptionExceptiontoConfigExceptionand all exceptions now extend a baseTwineExceptionclass
Detailed changelog: 2.3.0...3.0.0
2.3.0
Added
- Added global
str()helper function - Added
Str::words()method - Added casing methods
Str::camelCase()Str::studlyCase()Str::pascalCase()Str::snakeCase()Str::kebabCase()
Detailed changelog: 2.2.0...2.3.0
2.2.0
Added
- Added
Str::join()method
Changed
Str::append()andStr::prepend()now accept a variable number of arguments
Detailed changelog: 2.1.0...2.2.0
2.1.0
Added
- Added
Str::make()method for static constructing (thanks @roykesserwani) - Added
Str::urlencode()method - Added
Str::bcrypt()method - Added
Str::encrypt()andStr::decrypt()methods - Added
Str::truncate()method (thanks @roykesserwani) - Added
Str::similarity()method (thanks @ernst01) - Added
Str::hex()method- Added
Str::hexEncode()andStr::hexDecode()aliases
- Added
- Added
Str::first()andStr::last()aliases forStr::substring() - Added support for serializing (and unserializing) a
Twine\Strobject - Added support for
json_encode-ing aTwine\Strobject (they will be converted to a string) (thanks @erikverbeek)
Changed
- Cast the value passed to the
Str()constructor to a string
Fixed
- Fixed trait name misspelling:
Twine\Traits\Convinience→Twine\Traits\Convenience - Fixed
Str::insensitiveMatch()not returning anything - Fixed
Str::lowercase(Twine\Config\Lowercase::WORDS)not working on strings following tabs and newline characters (thanks @dhrrgn)
Other
- Optimized
Str::lowercase(Twine\Config\Lowercase::WORDS)when acting on a long string (thanks @dhrrgn) - Optimized
Str::hex()method when acting on long a string (thanks @dhrrgn)
Detailed changelog: 2.0.0...2.1.0
2.0.0
Added
- Added
Str::startsWith(),Str::endsWith()andStr::contains()methods - Added a slew of method aliases
Changed
- Bumped minimum required PHP version to 7.0
- Updated
Str::crypt()method to always require a salt - Split config options into separate classes and refactored the way they are validated
- Modifed
Str::md5(),Str::sha1(),Str::sha256()methods to accept a mode flag
Detailed changelog: 1.0.0...2.0.0