PHP Classes

File: demo/hello-world.php

Recommend this page to a friend!
  Classes of Rodolfo Berrios Arce   Workflow   demo/hello-world.php   Download  
File: demo/hello-world.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Workflow
Create and run action workflows
Author: By
Last change:
Date: 25 days ago
Size: 773 bytes
 

Contents

Class file image Download
<?php

/*
 * This file is part of Chevere.
 *
 * (c) Rodolfo Berrios <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use
Chevere\Demo\Actions\Greet;
use function
Chevere\Workflow\run;
use function
Chevere\Workflow\sync;
use function
Chevere\Workflow\variable;
use function
Chevere\Workflow\workflow;

require
'loader.php';

/*
php demo/hello-world.php Rodolfo
php demo/hello-world.php
*/

$workflow = workflow(
   
greet: sync(
        new
Greet(),
       
username: variable('username'),
    ),
);
$run = run(
   
$workflow,
   
username: $argv[1] ?? 'World'
);
$greet = $run->response('greet')->string();
echo <<<PLAIN
{
$greet}

PLAIN;