Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
arutyunyan committed Apr 22, 2024
1 parent c740118 commit 68fb93f
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ set_decorator_prop($progress, 'status', 'progress'); // status is one of possib
set_decorator_prop($progress, 'caption', 'in progress ...'); // just a string (max length is 32)
```

# Attributes
# Router
```php
class Controller
{
Expand All @@ -113,3 +113,25 @@ class Controller
// index.php
(new Route('/hello/Yuriy'))->getMethod(Controller::class)->run(); // output: Hello, Yuriy
```

# Console
```php
use Sagittaracc\PhpPythonDecorator\Decorator;
use Sagittaracc\PhpPythonDecorator\modules\console\core\Console;

class Controller
{
use Decorator;

#[Console('/hello')]
function greetingPerson($name)
{
return "Hello, $name";
}
}

// example from the command line: php index.php -c hello --name Yuriy
// in index.php you should read the command and the parameters
// and then call it like this:
(new Console('hello'))->setParameters(['name' => 'Yuriy'])->run();
```

0 comments on commit 68fb93f

Please sign in to comment.