Skip to content

Instantly share code, notes, and snippets.

@ilya-dev ilya-dev/project_x0.php
Last active Aug 29, 2015

Embed
What would you like to do?
Something I am working on...
<?php
// command-name {name:required} {age:optional:"Jack"}
// command-name {--name} {--age:required} {--country:optional:USA}
// facade:resolve "Show underlying classes and the corresponding IoC bindings" {query:optional:"Query string":"*"}
listen("say-hello")->act(function($input, $output) {
$output("Hello, world!");
});
listen("say-name {--name:required:Generic}")->act(function($input, $output) {
$output("Hello, ".$input("name"));
});
listen("do-something {age:required} {country:optional:USA} {--save:optional} {--path:required}")
->act(function($input, $output)
{
$savePath = $input("save") ? $input("path", "generic/path") : null;
$message = sprintf("%s:%s => %s", $input("age"), $input("country"), $savePath);
$output($message);
});
go();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.