<?php

/**
 * Likkle is a composer compatible PHP client library for the lk2.in
 *  URL shortener service (http://lk2.in).
 *
 * @author Bobby Allen <*****@*****.**>
 * @version 2.0.0
 * @license http://opensource.org/licenses/MIT
 * @link https://github.com/bobsta63/likkle
 * @link http://bobbyallen.me
 *
 */
require_once '../src/Ballen/Likkle/Lk2inClient.php';
use Ballen\Likkle\Lk2inClient;
$lk2client = new Lk2inClient();
/**
 * You can optioanlly configure a proxy server (both non-authenticated and authenticated!)
 */
//$lk2client->setProxyHost('proxy.example.com')->setProxyAuth('your_username', 'your_password');
/**
 * Example of creating a standard short URL.
 */
$thenewurl = $lk2client->getShortUrl('https://github.com/bobsta63/likkle');
echo "Your new URL is: <a href=\"" . $thenewurl . "\">" . $thenewurl . "</a>.";
// Raw examplexample of outputting the repsonse in plaintext.
//echo "Raw request was: <br>" . $lk2client->getRawResponse();
// Vardump of the repsonse object:-
//echo "Response object is: <br>" . var_dump($lk2client->getResponseObject());
/**
 * Example of creating a new short URL and ensuring that it has it's own 'click counter' instead of using the global click counter.
<?php

/**
 * Likkle is a composer compatible PHP client library for the lk2.in
 *  URL shortener service (http://lk2.in).
 *
 * @author Bobby Allen <*****@*****.**>
 * @version 2.0.0
 * @license http://opensource.org/licenses/MIT
 * @link https://github.com/bobsta63/likkle
 * @link http://bobbyallen.me
 *
 */
require_once '../src/Ballen/Likkle/Lk2inClient.php';
use Ballen\Likkle\Lk2inClient;
$lk2client = new Lk2inClient();
$shortcode = 'cU';
$number_of_clicks = $lk2client->getClicks($shortcode);
switch ($number_of_clicks) {
    case 0:
        $stub = "never";
        break;
    case 1:
        $stub = " once";
        break;
    default:
        $stub = $number_of_clicks . " times";
        break;
}
echo "The URL <a href=\"http://lk2.in/" . $shortcode . "\">http://lk2.in/" . $shortcode . "</a> has been clicked " . $stub . ".";