PHP code example of skrtdev / prototypes

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

    

skrtdev / prototypes example snippets


use skrtdev\Prototypes\Prototypeable;

class MyClass{
    use Prototypeable;
}

MyClass::addMethod('wow', function () {
    return "What a nice way to use PHP";
});

$instance = new MyClass();

echo $instance->wow();

use skrtdev\Prototypes\Prototypes;

var_dump(Prototypes::isPrototypeable($instance::class)); // you must pass the class name as string (use get_class() in php7.x)
var_dump(Prototypes::isPrototypeable(MyClass::class));