Download the PHP package ykw/cruet without Composer
On this page you can find all versions of the php package ykw/cruet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package cruet
Short Description PHP port of the Rust cruet library case conversion functions. Provides camelCase, snake_case, kebab-case, PascalCase and other case transformations.
License MIT
Informations about the package cruet
PHP Cruet
A fast, lightweight PHP library for string case conversions, based on the Rust cruet library.
Provides clean, efficient case conversions with a simple API.
Features
- 5 Case Conversions: camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case
- Format Detection: Identify string formats programmatically
- Fluent Interface: Chain operations for complex transformations
- High Performance: Character-by-character processing with intelligent boundary detection
- No Dependencies: Pure PHP implementation, no external libraries required
Installation
Or add to your composer.json
:
Quick Start
Usage Examples
Case Conversions
Format Detection
Fluent Interface
Chain multiple operations together:
API Reference
Static Case Conversion Methods
Inflector::toCamelCase(string $input): string
Inflector::toPascalCase(string $input): string
Inflector::toSnakeCase(string $input): string
Inflector::toScreamingSnakeCase(string $input): string
Inflector::toKebabCase(string $input): string
Static Format Detection Methods
Inflector::isCamelCase(string $input): bool
Inflector::isPascalCase(string $input): bool
Inflector::isSnakeCase(string $input): bool
Inflector::isScreamingSnakeCase(string $input): bool
Inflector::isKebabCase(string $input): bool
Fluent Interface
Inflector::convert(string $input): Inflector
- Create fluent chain->camelCase(): Inflector
- Convert to camelCase->pascalCase(): Inflector
- Convert to PascalCase->snakeCase(): Inflector
- Convert to snake_case->screamingSnakeCase(): Inflector
- Convert to SCREAMING_SNAKE_CASE->kebabCase(): Inflector
- Convert to kebab-case->get(): string
- Get final result
Requirements
- PHP 8.4 or higher
- No external dependencies
Testing
Run the test suite:
Or run PHPUnit directly:
Generate test coverage:
Code Quality
This project uses Mago for code formatting, linting, and static analysis:
Code quality checks run automatically via GitHub Actions on every push and pull request.
Contributing
Contributions are welcome! Please ensure:
- Test Coverage: Add tests for new functionality
- Documentation: Update README for new features
- Code Style: Follow PSR-12 coding standards
License
MIT License - see LICENSE file for details.
Credits
Based on the Rust cruet library by Chris Learn.