PHP code example of badams / google-url

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

    

badams / google-url example snippets


use badams\GoogleUrl\GoogleUrl;

$url = new GoogleUrl('YOUR_API_KEY_HERE');

// Shorten
echo $url->shorten('https://github.com')->id;
> https://goo.gl/un5E

// Expand
echo $url->expand($short->id)->longUrl;
> https://github.com;