abstractrs / url-shortener
Url Shortener for Laravel 5 with support for Google and Bitly drivers.
2.0.1
2019-05-16 08:33 UTC
Requires
- illuminate/config: 5.6.*|5.7.*|5.8.*
- illuminate/support: 5.6.*|5.7.*|5.8.*
- mremi/url-shortener: 2.2.x
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: 3.6.x|3.7.x|3.8.x
- phpunit/phpunit: ^7.0|^8.0
README
Introduction
URL shortener package that gives a convenient Laravel Facade for mremi/UrlShortener
Laravel compatibility
Installation and Setup
Require through composer
composer require abstractrs/url-shortener
Or manually edit your composer.json file:
"require": {
abstractrs/url-shortener": "^2.0"
}
In config/app.php, add the following entry to the end of the providers array:
Abstractrs\UrlShortener\UrlShortenerServiceProvider::class,
And the following alias:
'UrlShortener' => Abstractrs\UrlShortener\Facades\UrlShortener::class,
Publish the configuration file, the form view and the language entries:
php artisan vendor:publish --provider="Abstractrs\UrlShortener\UrlShortenerServiceProvider"
Check the config files for the environment variables you need to set for the selected driver.
Usage
Shorten a url
```php
\UrlShortener::shorten('http://google.com'); // Uses default driver as per config settings
\UrlShortener::driver('bitly')->shorten('http://google.com');
```
Expand a url
```php
\UrlShortener::expand('http://google.com'); // Uses default driver as per config settings
\UrlShortener::driver('bitly')->expand('http://google.com');
```