Download the PHP package robertaodj/str without Composer
On this page you can find all versions of the php package robertaodj/str. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download robertaodj/str
More information about robertaodj/str
Files in robertaodj/str
Download robertaodj/str
More information about robertaodj/str
Files in robertaodj/str
Vendor robertaodj
Package str
Short Description A modern PHP string manipulation library with fluent interface and extensive functionality
License MIT
Package str
Short Description A modern PHP string manipulation library with fluent interface and extensive functionality
License MIT
Please rate this library. Is it a good library?
Informations about the package str
Str - Modern PHP String Manipulation Library
A modern, fluent PHP library for string manipulation with extensive functionality inspired by Laravel's Str class and enhanced with additional features for Brazilian Portuguese development.
π English Documentation
Features
- π Fluent Interface: Chain methods for readable and maintainable code
- π Internationalization: Built-in support for Portuguese and English
- π Modern PHP: Requires PHP 8.2+ with full type declarations
- π± Brazilian Helpers: CPF, CNPJ, phone formatting and validation
- π§ Laravel-inspired: Methods compatible with Laravel's Str class
- π§ͺ Well-tested: Comprehensive test suite
- π Well-documented: Extensive documentation with examples
π When to use get() and when it's optional
β NO need for get() (automatic conversion):
- Echo and print:
echo Str::of('hello')->upper() - Concatenation:
"Result: " . Str::of('test')->title() - Interpolation:
"Value: $str" - Comparisons:
if ($str == 'expected') - Direct assignments:
$var = Str::of('test')->lower()
β οΈ Needs explicit cast (string):
- PHP functions:
strlen((string) $str) - PHP functions:
empty((string) $str) - Arrays:
['key' => (string) $str] - JSON:
json_encode(['key' => (string) $str])
π§ Always works with get():
- When in doubt, use
.get()at the end - To ensure full compatibility
- In contexts where string type is mandatory
Installation
Quick Start
Examples
Basic String Manipulation
Brazilian Portuguese Features
Advanced Features
Available Methods
Validation Methods
isEmail()- Check if string is a valid emailisHtml()- Check if string contains HTML tagsisJson()- Check if string is valid JSONisXml()- Check if string is valid XMLisSerialized()- Check if string is serializedisUrl()- Check if string is a valid URLisUuid()- Check if string is a valid UUID
Transformation Methods
camel()- Convert to camelCasestudly()- Convert to StudlyCasesnake()- Convert to snake_casekebab()- Convert to kebab-caseslug()- Create URL-friendly slugtitle()- Convert to Title Caseupper()- Convert to UPPERCASElower()- Convert to lowercase
Filtering Methods
alphanumeric()- Keep only alphanumeric charactersnumeric()- Keep only numbersalpha()- Keep only lettersremoveAccents()- Remove accents and diacriticsstripTags()- Remove HTML/XML tags
Formatting Methods
mask()- Apply formatting masks (CPF, CNPJ, phone, etc.)pad()- Pad string to specified lengthtrim()- Remove whitespace from both endstruncate()- Truncate to specified lengthwords()- Limit to specified number of words
Documentation
- π Complete API Documentation
- π§ Usage Examples
- π Migration Guide
- π§π· DocumentaΓ§Γ£o em PortuguΓͺs
Testing
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Credits
- Robert D Jesus
- Based on Simpla Components Str
- Inspired by Laravel's Str class
- All Contributors
All versions of str with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.2
ext-mbstring Version *
ext-json Version *
icanboogie/inflector Version ^3.0
ext-mbstring Version *
ext-json Version *
icanboogie/inflector Version ^3.0
The package robertaodj/str contains the following files
Loading the files please wait ...