PHP code example of dealroom / socials-helpers

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

    

dealroom / socials-helpers example snippets


use Dealroom\SocialsHelpers\Factory;
use Dealroom\SocialsHelpers\Normalizers\TwitterNormalizer;

$data = Factory::parseUrl('http://twitter.com/Dealroom', [TwitterNormalizer::getPlatform()])->getNormalizedUrl();

echo $data;

// "https://twitter.com/dealroom"

use Dealroom\SocialsHelpers\Factory;
use Dealroom\SocialsHelpers\Normalizers\TwitterNormalizer;

$data = Factory::parseUrl('https://twitter.com/dealroom', [TwitterNormalizer::getPlatform()])->getId();

echo $data;

// "dealroom"

use Dealroom\SocialsHelpers\Normalizers\AbstractNormalizer;
use Dealroom\SocialsHelpers\Normalizers\Factory;
use Dealroom\SocialsHelpers\Factory;

class CustomNormalizer extends AbstractNormalizer
{
    // Implement the interface methods
}

Factory::addNormalizer(CustomNormalizer::class);

$data = Factory::parseUrl('https://custom.com/Dealroom', [CustomNormalizer::getPlatform()])->getNormalizedUrl();