Download the PHP package junaidkhan/php-string-helper without Composer
On this page you can find all versions of the php package junaidkhan/php-string-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download junaidkhan/php-string-helper
More information about junaidkhan/php-string-helper
Files in junaidkhan/php-string-helper
Download junaidkhan/php-string-helper
More information about junaidkhan/php-string-helper
Files in junaidkhan/php-string-helper
Vendor junaidkhan
Package php-string-helper
Short Description A PHP helper library offering utilities like truncate, slugify, casing conversions, and more.
License MIT
Package php-string-helper
Short Description A PHP helper library offering utilities like truncate, slugify, casing conversions, and more.
License MIT
Please rate this library. Is it a good library?
Informations about the package php-string-helper
String Helper
String Helper is a PHP helper library for common string operations, built for PHP 8+.
Features
- Convert strings to
camelCase
,snake_case
, andkebab-case
- Truncate strings by character count (with word-safe, custom suffixes and HTML-stripping or HTML-preserving)
- Limit strings by word count with custom suffixes
- Check if strings start with, end with, or contain a substring
- Reverse strings easily
- Remove special characters with optional Unicode, dash, or underscore preservation
- Detect valid JSON strings with a simple check
- Create clean slugs for URLs or SEO
Installation
Install via Composer:
Usage
1. Autoload with Composer
2. Import the class
3. Use the methods
Methods
Method | Parameters | Description |
---|---|---|
slugify |
string $string |
Convert a string into a URL-friendly slug |
toCamelCase |
string $text |
Convert to camelCase |
toSnakeCase |
string $text |
Convert to snake_case |
toKebabCase |
string $text |
Convert to kebab-case |
startsWith |
string $haystack, string $needle |
Check if string starts with a given substring |
endsWith |
string $haystack, string $needle |
Check if string ends with a given substring |
contains |
string $haystack, string $needle |
Check if string contains a given substring |
truncate |
string $text, int $maxLength, string $suffix, bool $wordSafe, bool $stripHtml, bool $preserveHtml |
Truncate string with full support for HTML, suffix, and word-safety |
limitWords |
string $text, int $wordLimit, string $suffix |
Limit string by number of words, appending suffix if trimmed |
reverse |
string $text |
Reverse the given string |
removeSpecialChars |
string $text, bool $preserveUnderscore, bool $preserveDash, bool $allowUnicode |
Remove all non-alphanumeric characters (with optional preservation) |
isJson |
string $string |
Check if the string is valid JSON |
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
🙌 Contributing
Contributions are welcome! Feel free to fork the repository, open issues, or submit pull requests to help improve the package.
All versions of php-string-helper with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.0
The package junaidkhan/php-string-helper contains the following files
Loading the files please wait ....