madeny / url-shortener
Url Shortener for Laravel 5 with support for Google and Bitly drivers.
dev-master
2019-11-17 01:05 UTC
Requires
- illuminate/contracts: 5.6.*
- illuminate/support: 5.6.*
- mremi/url-shortener: ^2.1
Requires (Dev)
- mockery/mockery: ^1.0.0
- orchestra/testbench: 3.6.4
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-11-17 12:42:06 UTC
README
Smattering
URL shortener package with Laravel Package Auto-Discovery.
Installation and Setup
Require through composer
composer require madeny/url-shortener
Or manually edit your composer.json file:
"require": {
"madeny/url-shortener": "1.0"
}
Config: .env to have this for bitly driver:
URL_SHORTENER_BITLY_USERNAME=username
URL_SHORTENER_BITLY_PASSWORD=password
for google driver:
URL_SHORTENER_GOOGLE_API_KEY=apikey
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');
```