dotKebab.php
Table of Contents
Functions
- dotKebab() : string
- Converts a camelCase or PascalCase string into a format where the first word is separated by a dot (.) from the rest, which are joined using kebab-case (-).
Functions
dotKebab()
Converts a camelCase or PascalCase string into a format where the first word is separated by a dot (.) from the rest, which are joined using kebab-case (-).
dotKebab(string|null $source) : string
This is useful for creating structured identifiers or keys that use a namespace-like prefix separated by a dot, followed by a kebab-case suffix.
Internally, this function uses snake() to normalize the input string into lowercase segments separated by a custom delimiter.
Examples:
- "serverAskJwtSecret" → "server.ask-jwt-secret"
- "UserProfilePage" → "user.profile-page"
- "APIKeyManager" → "api.key-manager"
- "foo" → "foo"
- null → ""
Parameters
- $source : string|null
-
The camelCase or PascalCase string to convert.
Tags
Return values
string —The converted string in dot + kebab-case format.