PHP code example of sweetchuck / robo-stringy

1. Go to this page and download the library: Download sweetchuck/robo-stringy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sweetchuck / robo-stringy example snippets




class RoboFile extends \Robo\Tasks
{
    use \Sweetchuck\Robo\Stringy\StringyTaskLoader;
    
    /**
     * @command stringy:simple
     */
    public function cmdStringySimple(string $text = 'Hello', string $suffix = 'World')
    {
        return $this
            ->collectionBuilder()
            ->addTask(
                $this
                    ->taskStringy()
                    ->setString($text)
                    ->callIsUpperCase()
                    ->callAppend(" $suffix")
                    ->callUnderscored()
            )
            ->addCode(function (\Robo\State\Data $data): int {
                $output = $this->output();
                $output->writeln('Is upper case: ' . var_export($data['stringy.isUpperCase'], true));
                $output->writeln("Result: {$data['stringy']}");

                return 0;
            });
    }
}