PHP code example of ilya / ron

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


 namespace demo;

interface Foo {
    public function bar(stdClass $so, $amaze = null);
}

abstract class Baz {
    abstract protected function wow($such, stdClass $doge = null); 
}


// you could pass "demo\Foo" as the argument instead
$ron = new \Ron\Ron(new \ReflectionClass('demo\Baz'));

$entity = $ron->create();

$methods = ['wow' => 'Hello, world!'];

$entity = (new \Ron\Ron(new \ReflectionClass('demo\Baz')))->create($methods);

$entity->apply();
$name = $entity->getClassName();

(new $name)->wow('Hey!'); // Hello, world!