PHP code example of andrzejkupczyk / url-shortener

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

    

andrzejkupczyk / url-shortener example snippets


$shortener = UrlShortener::bitly($apiUri, $apiKey);

$link = $shortener->shorten(new Url('https://github.com/andrzejkupczyk/url-shortener'));

print($link->shortUrl()); // http://bit.ly/2Dkm8SJ

$shortener = UrlShortener::bitly($apiUri, $apiKey);

$link = $shortener->expand(new Url('http://bit.ly/2Dkm8SJ'));

print($link->longUrl()); // https://github.com/andrzejkupczyk/url-shortener

php artisan vendor:publish --provider="WebGarden\UrlShortener\LaravelServiceProvider"