sweetchuck / robo-string
Exposes string manipulation methods from the symfony/string package
Installs: 645
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:robo-tasks
Requires
- php: >=8.3
- consolidation/robo: ^5.0
- symfony/string: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- ext-json: *
- codeception/codeception: ^5.0
- codeception/module-asserts: ^3.0
- nuvoleweb/robo-config: 4.x-dev
- phpstan/phpstan: ^1.11
- squizlabs/php_codesniffer: ^3.5
- sweetchuck/codeception-module-robo-task-runner: 4.x-dev
- sweetchuck/git-hooks: 2.x-dev
- sweetchuck/robo-git: 4.x-dev
- sweetchuck/robo-phpcs: 4.x-dev
- sweetchuck/robo-phpstan: 3.x-dev
- symfony/error-handler: ^5.0 || ^6.0 || ^7.0
- symfony/finder: ^5.0 || ^6.0 || ^7.0
- symfony/yaml: ^5.0 || ^6.0 || ^7.0
This package is auto-updated.
Last update: 2024-11-06 20:32:14 UTC
README
This Robo task is useful when you need to do string manipulation in a
\Robo\State\Data
.
Install
composer require sweetchuck/robo-string
Task - taskStringUnicode()
<?php declare(strict_types = 1); use Robo\Tasks; use Robo\State\Data as StateData; use Sweetchuck\Robo\String\StringTaskLoader; class RoboFileExample extends Tasks { use StringTaskLoader; /** * @command string:simple */ public function cmdStringSimpleExecute(string $string = 'Hello', string $suffix = 'World') { return $this ->collectionBuilder() ->addTask( $this ->taskStringUnicode() ->setString($string) ->callIsEmpty() ->callAppend(" $suffix") ->callSnake() ) ->addCode(function (StateData $data): int { $output = $this->output(); $output->writeln('Is empty: ' . var_export($data['string.isEmpty'], true)); $output->writeln("Snake: {$data['string.snake']}"); $output->writeln("Result: {$data['string']}"); return 0; }); } }
Run vendor/bin/robo string:simple
Output:
Is empty: false Snake: hello_world Result: hello_world