PHP code example of fuelphp / alias

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

    

fuelphp / alias example snippets


// Create a new alias manager
$manager = new Fuel\Alias\Manager;

// Register the manager
$manager->register();

// Alias one class
$manager->alias('Alias\Me', 'To\This');

// Or alias many
$manager->alias([
	'Alias\This' => 'To\Me',
	'AndAlias\This' => 'To\SomethingElse',
]);

//

// alias to a less deep namespace
$manager->aliasNamespace('Less\Deep', 'Some\Super\Deep\Name\Space');


// alias a namespace to global
$manager->aliasNamespace('Some\Space', '');

$manager = new Fuel\Alias\Manager;

// Alias with wildcards
$manager->aliasPattern('Namespaced\*', 'Other\\$1');

$otherThing = new Namespaced\Thing;