PHP code example of ilya / dynamic

1. Go to this page and download the library: Download ilya/dynamic 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/ */

    

ilya / dynamic example snippets


 Dynamic\DynamicTrait;

class Example {

    use DynamicTrait;

    public function __construct()
    {
        $this->getDynamicInstance()->redirect('/^say(\w+)To$/', 'say');
    }

    public function say($what, $to)
    {
        echo ucfirst("$what, $to!"), PHP_EOL;
    }

}

$example = new Example;

echo $example->sayHelloTo('Jack'), $example->sayByeTo('John');

shell
git clone https://github.com/ilya-dev/dynamic.git
cd dynamic
php examples/first.php
shell
php composer.phar