emrekaya/google-url-shortener

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

Google URL Shortener API Package for Laravel 5.6 & Higher

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


README

Latest Stable Version Total Downloads Monthly Downloads PHP Version License

How to install?

composer require emrekaya/google-url-shortener

How to publish config file?

php artisan vendor:publish --provider="Shortener\\Providers\\ShortenerServiceProvider" --tag="config"

How to setup?

You must add GOOGLE_URL_SHORTENER_API_KEY=YOUR_API_KEY it to the .env file to use this package.

How to use?

How to short link?

Shortener::short('YOUR_LINK')->getId();

How to get shorted link?

Shortener::find('https://goo.gl/SHORTENER_ID')->getLongUrl();

How to get analytics for shorted link?

$analytic = Shortener::analytics('https://goo.gl/SHORTENER_ID');
Available analytic class methods

This methods return integer

$analytic->getAllTimeShortUrlClicks();
$analytic->getMonthlyShortUrlClicks();
$analytic->getWeeklyShortUrlClicks();
$analytic->getDailyShortUrlClicks();
$analytic->getLastTwoHoursShortUrlClicks();

$analytic->getAllTimeLongUrlClicks();
$analytic->getMonthlyLongUrlClicks();
$analytic->getWeeklyLongUrlClicks();
$analytic->getDailyLongUrlClicks();
$analytic->getLastTwoHoursLongUrlClicks();

This methods return object

$analytic->getAllTimeAnalytics();
$analytic->getMonthlyAnalytics();
$analytic->getWeeklyAnalytics();
$analytic->getDailyAnalytics();
$analytic->getLastTwoHoursAnalytics();

For more information; Click here!

How to short link on CLI?

php artisan google:short-url URL

How to get shorted link on CLI?

php artisan google:find-url https://goo.gl/SHORTENER_ID

How to test?

Copy .env.test.example to .env.test

cp .env.example.test .env.test

Add GOOGLE_URL_SHORTENER_API_KEY=YOUR_API_KEY to .env.test file.

Run...

composer test