https://github.com/nabeghe/stringer-php
A string helper for PHP. It includes some useful methods and possibly other features.
https://github.com/nabeghe/stringer-php
php string string-helper strings text texthelper
Last synced: 5 months ago
JSON representation
A string helper for PHP. It includes some useful methods and possibly other features.
- Host: GitHub
- URL: https://github.com/nabeghe/stringer-php
- Owner: nabeghe
- License: mit
- Created: 2024-10-16T12:09:27.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-11-08T02:38:32.000Z (8 months ago)
- Last Synced: 2025-11-08T04:17:00.080Z (8 months ago)
- Topics: php, string, string-helper, strings, text, texthelper
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Stringer (String Helper for PHP ≥ 7.4)
> A string helper for PHP. It includes some useful methods and possibly other features.
Some of the methods from the Str class of the Laravel framework are also included in this library;
however, some of them have been modified.
## 🫡 Usage
### 🚀 Installation
You can install the package via composer:
```bash
composer require nabeghe/stringer
```
### Str Class
The main class that includes the useful methods is `Nabegh\String\Str`.
#### Example:
```php
use Nabeghe\Stringer\Str;
echo Str::random(32);
echo Str::random(32, '0123456789');
```
### UnicodeControls Class
A class that includes some Unicode control characters;
for example, the invisible character, or the right-to-left and left-to-right markers.
```php
use Nabeghe\Stringer\UnicodeControls;
echo UnicodeControls::ISS; // Invisible
```
### Stringer Class
A string class.
Accepts any value, converts it to a string via strval, stores it, and returns it via __toString.
It is possible to access the methods of the `Str` class through the `Stringer` object as well, with the difference that the main text parameter is no longer present.
```php
use Nabeghe\Stringer\Stringer;
$string = new Stringer('In programming, a string is a sequence of characters, and string manipulation processes these characters.');
echo $string->after('string ')->before(','); // `is a sequence of characters`
```
## 📖 License
Licensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.