1. Go to this page and download the library: Download roddy/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/ */
roddy / url-shortener example snippets
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->store()
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->customKey("custom-url-key") //param should be a string
->store()
->generate();
// Short URL: https://domain.com/custom-key
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->customKey("custom-url-key") //param should be a string
->generate();
// Short URL: https://domain.com/custom-key
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->byUserId(1) //param should be a string or int
->store()
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->byUserId(1) //param should be a string or int
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->schedule(2) //This will schedule it to the next 2 days
->store()
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->schedule(2) //This will schedule it to the next 2 days
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->generateQrCodeImage() //add this method
->store()
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->generateQrCodeImage() //add this method
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->generateQrCodeSvg() //add this method
->store()
->generate();
use Roddy\UrlShortener\UrlShortenerGenerator;
UrlShortenerGenerator::originalUrl('https://orginalurl.com')
->generateQrCodeSvg() //add this method
->generate();
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::findById(1);
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::findByKey('aBcD234');
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::findByOriginalUrl("https://destination.com");
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::findWhere("id", ">", "1");
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::findWhere("id", null, "1");
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::getAl);
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::deleteById(1);
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::deleteByKey('aBcD234');
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::deleteByOriginalUrl('https://originalUrl.com');
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::deleteWhere("id", ">", "1");
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = UrlShortenerModel::deleteWhere("id", null, "1");
use Roddy\UrlShortener\Model\UrlShortenerModel
$shortURL = urlShortenerDB::findOrFail(1); //You can use any of the Eloquent query building