PHP code example of mlopez / url-shortener

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

    

mlopez / url-shortener example snippets


public function test_url_shortener()
{
    $this->post(route('links.store'), [
        'long_url' => 'https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers'
    ]);

    $this->assertDatabaseHas(config('urlshortener.table'), [
        'long_url' => 'https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers'
    ]);
}

php artisan vendor:publish --tag=url-shortener-migrations

php artisan vendor:publish --tag=url-shortener-config

php artisan url-shortene:install