php-eight-four / string-utils
String utilities for PHP 8.4
Package info
github.com/eri-bga/php-eight-four-string-utils
pkg:composer/php-eight-four/string-utils
v1.1.0
2025-05-12 14:18 UTC
Requires (Dev)
- phpunit/phpunit: ^10
This package is auto-updated.
Last update: 2026-04-12 18:47:11 UTC
README
A lightweight utility library to help with common string manipulations in PHP 8.4.
๐งฉ Features
This package provides easy-to-use static methods for transforming and analyzing strings, including:
- Convert strings to:
camelCasePascalCasesnake_casekebab-case
- Check if a string is a palindrome
๐ ๏ธ Installation
You can install this package via Composer:
composer require php-eight-four/string-utils
๐งช Usage Examples
Import the class:
use PhpEightFour\StringUtils\StringUtils;
Convert to camelCase
echo StringUtils::toCamelCase("hello world"); // Outputs: helloWorld
Convert to PascalCase
echo StringUtils::toPascalCase("hello world"); // Outputs: HelloWorld
Convert to snake_case
echo StringUtils::toSnakeCase("HelloWorld"); // Outputs: hello_world
Convert to kebab-case
echo StringUtils::toKebabCase("HelloWorld"); // Outputs: hello-world
Check if a string is a palindrome
var_dump(StringUtils::isPalindrome("RaceCar")); // Outputs: true var_dump(StringUtils::isPalindrome("Hello")); // Outputs: false
๐ Namespace Structure
All classes are under the namespace:
\PhpEightFour\StringUtils\
๐ Requirements
- PHP 8.4 or higher
- Composer (for installation)
๐งโ๐ป Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
- Fork the repo
- Create your feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Submit a pull request
๐ License
MIT License โ see the LICENSE file for details.
๐ฌ Contact
If you have any questions or suggestions, feel free to reach out at: