1. Go to this page and download the library: Download chapdel/uri 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/ */
chapdel / uri example snippets
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->make();
$shortURL = $shortURLObject->default_short_url;
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->urlKey('custom-key')->make();
$shortURL = $shortURLObject->default_short_url;
// Short URL: https://webapp.com/short/custom-key
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits(false)->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackIPAddress()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackBrowser()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackBrowserVersion()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackOperatingSystem()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackOperatingSystemVersion()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackDeviceType()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackRefererURL()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->singleUse()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('http://destination.com?param1=test')->forwardQueryParams()->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('http://destination.com')->redirectStatusCode(302)->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->activateAt(\Carbon\Carbon::now()->addDay())->make();
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->activateAt(\Carbon\Carbon::now()->addDay())
->deactivateAt(\Carbon\Carbon::now()->addDays(2))
->make();
namespace App\Http\Controllers;
use ShortURL;
class Controller
{
public function index()
{
$shortURLObject = ShortURL::destinationUrl('https://destination.com')->make();
...
}
}
use AshAllenDesign\ShortURL\Classes\Builder;
$shortURLObject = (new Builder())
->destinationUrl('https://destination.com');
if ($request->date('activation')) {
$builder = $builder->activateAt($request->date('activation'));
};
$shortURLObject = $builder->make();)
use AshAllenDesign\ShortURL\Classes\Builder;
use Carbon\Carbon;
$shortURLObject = (new Builder())
->destinationUrl('https://destination.com')
->when(
$request->date('activation'),
function (Builder $builder, Carbon $activateDate): Builder {
return $builder->activateAt($activateDate);
},
)
->make();