定制 sweetchuck/robo-string 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sweetchuck/robo-string

Composer 安装命令:

composer require sweetchuck/robo-string

包简介

Exposes string manipulation methods from the symfony/string package

README 文档

README

CircleCI codecov

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

统计信息

  • 总下载量: 4.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2023-07-25