PHP code example of basteyy / plates-url-toolset

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

    

basteyy / plates-url-toolset example snippets


/** @var \League\Plates\Engine $engine */
$engine->loadExtension(new \basteyy\PlatesUrlToolset\PlatesUrlToolset());

/** @var \League\Plates\Engine $engine */
$engine->loadExtension(
    new \basteyy\PlatesUrlToolset\PlatesUrlToolset(
        null,  // The base URL for all URLs. Should be something like https://example.org
        true,  // Change the default value for using absolute URLs
        []     // Register named URLs for later use
    ));

echo $this->getCurrentUrl(); // Displays the current URL

echo $this->getLink('/foo', 'Click it!!', 'Yes, click me', 'btn big', false);

// Register the link in the constructor or via
$this->addNamedUrl('linkname', 'foobar');

echo $this->getNamedUrl('linkname');
echo $this->getNamedUrl('linkname', true);

// Register the link in the constructor or via
$this->addNamedUrl('linkname', 'foobar-123456789');

echo $this->getNamedLink('linkname', 'Click it!!', 'Yes, click me', 'btn big', false);

// Register the link in the constructor or via
echo $this->getDebugUrl('/foobar/file/something.css');

echo $this->getDebugUrl('/foobar/file/bar.jpg', true, 'blabla', 'aaaa');