PHP code example of matuck / aliasbundle

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

    

matuck / aliasbundle example snippets


$service = $this->get('matuck_alias');

//To create a new alias of /myalias which goes to path www.example.com/page/somepage
$service->createAlias('/myalias', '/page/somepage');

//Delete an alias of /myalias
$service->deleteAlias('/myalias');

//Get the true path for an alias in this case returns /page/somepage
$service->getTruepath('myalias');

//Gets an array of aliases for a truepath
$aliases = $service->getAliasesForTruePath('/page/somepage');
foreach($aliases as $alias)
{
    echo $alias->getAlias();
}

php composer.phar update