PHP code example of jgswift / recompilr

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

    

jgswift / recompilr example snippets


// # path/to/FooClass.php
class FooClass {
    /* */
}

// compiles FooClass from given class definition file
recompilr\execute('FooClass','path/to/FooClass.php');

// factory creates an instance of FooClass
$foo = recompilr\make('FooClass');

var_dump($foo); // (object) FooClass_*hash

// class must be available to autoloader
namespace MyNamespace;
class FooClass {
    /* */
}

// compiles FooClass without an explicit class file, relying on the autoloader to find the class definition
recompilr\execute('MyNamespace\FooClass');

// factory creates an instance of FooClass
$foo = recompilr\make('MyNamespace\FooClass');

var_dump($foo); // (object) FooClass_*hash

// change path/to/FooClass.php while application is running

recompilr\all();

recompilr\execute('MyNamespace\FooClass');

recompilr\binary('path/to/binary.rcx');

recompilr\load('path/to/binary.rcx');

$foo = recompilr\make('MyNamespace\FooClass');

var_dump($foo); // (object) FooClass_*hash
sh
php composer.phar