PHP code example of savepinner / pinterest-url-normalizer

1. Go to this page and download the library: Download savepinner/pinterest-url-normalizer 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/ */

    

savepinner / pinterest-url-normalizer example snippets




use SavePinner\PinterestUrlNormalizer\PinterestUrlNormalizer;

$parsed = PinterestUrlNormalizer::parse(
    'https://de.pinterest.com/pin/987654321/?utm_source=share',
);

echo $parsed->pinId;        // 987654321
echo $parsed->normalizedUrl; // https://www.pinterest.com/pin/987654321/

PinterestUrlNormalizer::isPinterestUrl('https://pin.it/AbC123'); // true
PinterestUrlNormalizer::normalize(
    'https://pinterest.co.uk/savepinner/media-tools/',
); // https://www.pinterest.com/savepinner/media-tools/