PHP code example of vinelab / url-shortener

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

    

vinelab / url-shortener example snippets


    'providers' => array(
        ...
		'Vinelab\UrlShortener\UrlShortenerServiceProvider'
    ),

	'default' => 'bitly',

        'bitly' => [
            'domain' => 'https://api-ssl.bitly.com',
            'endpoint' => '/v3/shorten',
            'token' => 'YOUR-TOKEN-HERE',
        ],

$long_url = 'http://testing.tst/something/12345/something-else/54321';

$short_url = Shorten\Shorten::url($long_url); // returns the short version of the long_url as a string
bash
php artisan vendor:publish --provider ='Vinelab\UrlShortener\UrlShortenerServiceProvider'