seworqs / phing-string
?
1.0.0
2025-04-25 14:38 UTC
Requires
- php: ^8.1
- seworqs/commons-string: ^2.0
Requires (Dev)
- phing/phing: ^3.0
- phpunit/phpunit: ^11
README
A collection of Phing tasks for string casing, namespaces, path conversion, and random string generation. Useful for manipulating and transforming strings within your Phing build process.
Installation
Install via Composer:
composer require seworqs/phing-string
Usage
Import the SEworqs task library in your build.xml
:
<import file="vendor/seworqs/phing-string/resources/phing/import.xml"/>
This will register all available tasks so you can use them directly:
<camelcase input="convert me to camel" /> <snakecase input="ConvertMeToSnake" /> <namespace input="src/Helper/StringHelper.php" /> <path input="App\Helper\StringHelper" /> <random length="16" />
Prefer to manage task registration yourself?
You can also define tasks individually using<taskdef>
. Seeexamples/example.xml
.
For more examples, see examples.xml
Features
- Convert strings to multiple casing formats
- Normalize namespaces from file paths
- Generate PSR-4 style file paths from namespaces
- Generate secure random strings
- Easy integration via
import.xml
, or define tasks manually
Tasks Overview
Namespace | Task Class | Purpose |
---|---|---|
Seworqs\Phing\Task\Casing | LowerCaseTask | Converts to lowercase |
UpperCaseTask | Converts to uppercase | |
CamelCaseTask | Converts to camelCase |
|
PascalCaseTask | Converts to PascalCase |
|
SnakeCaseTask | Converts to snake_case |
|
KebabCaseTask | Converts to kebab-case |
|
ScreamingSnakeCaseTask | Converts to SCREAMING_SNAKE_CASE |
|
ScreamingKebabCaseTask | Converts to SCREAMING-SNAKE-CASE |
|
TitleCaseTask | Converts to Title Case |
|
Seworqs\Phing\Task\Namespace | NamespaceTask | Extracts namespace from file path |
Seworqs\Phing\Task\Path | PathTask | Converts namespace to PSR-4 file path |
Seworqs\Phing\Task\Random | RandomTask | Generates a random string |
License
Apache-2.0 — see LICENSE
About SEworqs
SEworqs builds clean, reusable modules for PHP and Mendix developers.
Learn more at github.com/seworqs