PHP code example of monolyth / mural

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

    

monolyth / mural example snippets




$search = new Search;
echo get_class($search); // Straight\Search
echo $search instanceof Straight\Search; // true
echo $search instanceof Search; // also true!




$mural->rewrite('\\', 'Foo\\');

// Bar gets rewritten to Foo\Bar, but Bar\Baz is autoloaded verbatim.
class Bar extends Bar\Baz
{
}

// To rewrite Bar\Baz to Foo\Bar\Baz as well, you'd need an extra call to
// `rewrite` as follows:

$mural->rewrite('Bar', 'Foo\\Bar\\');




class SearchController
{
    public function search()
    {
        if ($_SERVER['SERVER_NAME'] == 'straight.com') {
            $search = new Straight\Search;
        } else {
            $search = new Gay\Search;
        }
        // ...
    }
}




class SearchController
{
    public function search()
    {
        $search = new Search;
        // ...
    }
}




$mural = new Monolyth\Mural\Autoloader;
$mural->rewrite('\\', 'Straight\\');




$mural = new Monolyth\Mural\Autoloader;
$mural->rewrite('\\', 'Straight\\`);




$mural = new Monolyth\Mural\Autoloader;
$mural->rewrite('\\', 'Gay\\');