PHP code example of andrey-helldar / short-url

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

    

andrey-helldar / short-url example snippets


Helldar\ShortUrl\ServiceProvider::class;

use \Helldar\ShortUrl\Facades\ShortUrl;

$item = ShortUrl::set('https://example.com');
// returned instance of `Helldar\ShortUrl\Models\Short` eloquent model.

use \Helldar\ShortUrl\Facades\ShortUrl;

$url = ShortUrl::get('foo');
// returned URL string.
// For example, 'http://<your_site>.com/go/qdr'.

use \Helldar\ShortUrl\Facades\ShortUrl;

$item = ShortUrl::set('https://example.com');

return route('short_url', ['key' => $item->key]); 

use \Helldar\ShortUrl\Facades\ShortUrl;

$url = ShortUrl::get('foo');

return redirect()->away($url); 

php artisan vendor:publish --provider="Helldar\ShortUrl\ServiceProvider"