PHP code example of boomdraw / canonicalizer

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

    

boomdraw / canonicalizer example snippets


// bootstrap/app.php:
$app->withFacades();

// bootstrap/app.php:
$app->register(Boomdraw\Canonicalizer\CanonicalizerServiceProvider::class);

use Boomdraw\Canonicalizer\Facades\Canonicalizer;

use Canonicalizer;

Canonicalizer::macro('replaceSpaces', function(string $string) {
    return str_replace(' ', '', $string);  
});

Canonicalizer::replaceSpaces('Hello World!') === 'HelloWorld!';