1. Go to this page and download the library: Download innmind/reflection 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/ */
innmind / reflection example snippets
use Innmind\Reflection\Instanciate;
use Innmind\Immutable\{
Map,
Maybe,
};
final class Foo
{
private int $foo;
private mixed $bar;
public function __construct(string $foo)
{
$this->foo = $foo;
}
}
$object = (new Instanciate)(Foo::class, Map::of(
['foo', 42],
['bar', 'baz'],
)); // Maybe<Foo>
use Innmind\Reflection\Extract;
use Innmind\Immutable\{
Set,
Maybe,
Map,
};
$properties = (new Extract)($myObject, Set::of('foo', 'bar', 'baz')); // Maybe<Map<non-empty-string, mixed>>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.