PHP code example of xiaodi / think-short-url

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

    

xiaodi / think-short-url example snippets


use ShortUrl\Facade\ShortUrl;

ShortUrl::make('baidu')->create('https://www.baidu.com');

use ShortUrl\Facade\ShortUrl;

ShortUrl::make('baidu')->query('https://dwz.cn/JCRnHXWE');

use ShortUrl\Facade\ShortUrl;

ShortUrl::make('baidu')->delete('JCRnHXWE');

use ShortUrl\Facade\ShortUrl;

ShortUrl::make('sina')->create('https://www.baidu.com');

// 生成百度短链
shorturl_baidu($url);

// 生成新浪短链
shorturl_sina($url);