PHP code example of brick / reflection

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

    

brick / reflection example snippets




namespace App;

use Foo\Bar;
use Foo\Bar\Baz as Alias;

class Test {

}

use Brick\Reflection\ImportResolver;

$class = new ReflectionClass(App\Test::class);
$resolver = new ImportResolver($class);

echo $resolver->resolve('\Some\FQCN\Class'); // Some\FQCN\Class
echo $resolver->resolve('Something'); // App\Something
echo $resolver->resolve('Something\Else'); // App\Something\Else
echo $resolver->resolve('Bar'); // Foo\Bar
echo $resolver->resolve('Bar\tender'); // Foo\Bar\tender
echo $resolver->resolve('Alias'); // Foo\Bar\Baz
echo $resolver->resolve('Alias\ooka'); // Foo\Bar\Baz\ooka