PHP code example of tly / laravel-url-shortener-api

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

    

tly / laravel-url-shortener-api example snippets


use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::create([
    'long_url' => 'https://example.com',
    'description' => 'Example Link',
]);



use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::update([
    'short_url' => 'https://t.ly/123',
    'long_url' => 'https://new-destination.com',
    'description' => 'Updated Link Description',
    'expire_at_datetime' => '2035-12-31 23:59:59',
]);


use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::delete('https://t.ly/123');


use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::get('https://t.ly/123');


use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::stats('https://t.ly/123');

bash
php artisan vendor:publish --provider="TLY\\LaravelUrlShortener\\TLYServiceProvider" --tag=config