tooleks/url-shortener

This package is abandoned and no longer maintained. No replacement package was suggested.

The Laravel 5 Url Shortener Package

This package has no released version yet, and little information is available.


README

Installation

Package Installation

Execute the following command to get the latest version of the package:

composer require tooleks/url-shortener

App Configuration

To register the service simply add Tooleks\UrlShortener\Providers\UrlShortenerServiceProvider::class into your config/app.php to the end of the providers array:

'providers' => [
    ...
    Tooleks\UrlShortener\Providers\UrlShortenerServiceProvider::class,
],

If you prepare to use the service via facade interface add 'UrlShortener' => Tooleks\UrlShortener\Facades\UrlShortener::class into your config/app.php to the end of the aliases array:

'aliases' => [
    ...
    'UrlShortener' => Tooleks\UrlShortener\Facades\UrlShortener::class,
],

Publish migration scripts with the command:

php artisan vendor:publish --provider="Tooleks\UrlShortener\Providers\UrlShortenerServiceProvider" --tag="migrations"

Run migration scripts:

php artisan migrate

Usage Examples

Via Service
use \Tooleks\UrlShortener\Services\Contracts\UrlShortenerServiceContract;

$urlShortener = app(UrlShortenerServiceContract::class);

$shortUrl = $urlShortener->getShortUrl($longUrl);
use \Tooleks\UrlShortener\Services\Contracts\UrlShortenerServiceContract;

$urlShortener = app(UrlShortenerServiceContract::class);

$longUrl = $urlShortener->getLongUrl($shortUrl);
Via Service Facade
$shortUrl = UrlShortener::getShortUrl($longUrl);
$longUrl = UrlShortener::getLongUrl($shortUrl);