About this project
Str2Name is a dependency-free PHP library designed to convert strings into a wide variety of named formats. It provides a comprehensive set of static methods to handle string transformations, with optional support for the `mbstring` extension to improve non-ASCII case conversion.
The library offers three main types of formatters:
1. Generic Formatters: Supports standard casing styles such as snake_case, camelCase, PascalCase, kebab-case, train-case, flatcase, and COBOL-CASE.
2. Format Converters: Provides direct methods to convert between generic formats (e.g., `snake2camel`, `camel2kebab`).
3. Named Formatters: Includes specialized conversions for specific technical contexts, such as:
- Web: `cssClass`, `cssId`, `host`, `domain`.
- PHP: `phpClass`, `phpMethod`, `phpFunction`, `phpNamespace`.
- General: `constant`, `machine`, `filepath`, `id`.
Many named formatters include a `Raw` version that preserves original characters (like Unicode) where the standard version might strip or normalize them.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.