2017 © Pedro Peláez
 

library shorty

Google Url Shortener API Package for Laravel 5.1

image

shortener/shorty

Google Url Shortener API Package for Laravel 5.1

  • Friday, March 2, 2018
  • by wardan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 0 Open issues
  • 10 Versions
  • 24 % Grown

The README.md

Shorty

Latest Version on Packagist ![Software License][ico-license] Total Downloads, (*1)

Google Url Shortener API Package for Laravel 5.*. Library to shorten URLs, expand URLs, and get stats for shortened URLs. e.g. goo.gl/XXXXX, (*2)

Installation

To install, run the following in your project directory, (*3)

``` bash $ composer require mbarwick83/shorty, (*4)


Then in `config/app.php` add the following to the `providers` array:

Mbarwick83\Shorty\ShortyServiceProvider::class, (*5)


Also in `config/app.php`, add the Facade class to the `aliases` array:

'Shorty' => Mbarwick83\Shorty\Facades\Shorty::class, (*6)


## Configuration To publish Shorty's configuration file, run the following `vendor:publish` command:

php artisan vendor:publish --provider="Mbarwick83\Shorty\ShortyServiceProvider", (*7)


This will create a shorty.php in your config directory. Here you **must** enter your Google Shortener URL API Key. Get an API key at [https://developers.google.com/url-shortener/v1/getting_started#APIKey](https://developers.google.com/url-shortener/v1/getting_started#APIKey). ## Usage **Be sure to include the namespace for the class wherever you plan to use this library**

use Mbarwick83\Shorty\Facades\Shorty;, (*8)


#####To shorten a URL: ``` php $url = "http://google.com"; Shorty::shorten($url); // returns, http://goo.gl/XXXXX
To expand a shortened URL:

``` php $url = "http://goo.gl/XXXXX";, (*9)

Shorty::expand($url);, (*10)

// returns, http://google.com, (*11)


#####To get stats on shortened URL: ``` php $url = "http://goo.gl/XXXXX"; Shorty::stats($url);

If successful, stats response will return:, (*12)

{
 "kind": "urlshortener#url",
 "id": "http://goo.gl/fbsS",
 "longUrl": "http://www.google.com/",
 "status": "OK",
 "created": "2009-12-13T07:22:55.000+00:00",
 "analytics": {
  "allTime": {
   "shortUrlClicks": "3227",
   "longUrlClicks": "9358",
   "referrers": [ { "count": "2160", "id": "Unknown/empty" } /* , ... */ ],
   "countries": [ { "count": "1022", "id": "US" } /* , ... */ ],
   "browsers": [ { "count": "1025", "id": "Firefox" } /* , ... */ ],
   "platforms": [ { "count": "2278", "id": "Windows" } /* , ... */ ]
  },
  "month": { /* ... */ },
  "week": { /* ... */ },
  "day": { /* ... */ },
  "twoHours": { /* ... */ }
 }
}

Change log

Please see CHANGELOG for more information what has changed recently., (*13)

Testing

bash $ composer test, (*14)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*15)

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker., (*16)

License

The MIT License (MIT). Please see License File for more information., (*17)

The Versions

02/03 2018

dev-master

9999999-dev https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

02/03 2018

2.1

2.1.0.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

02/11 2017

2.0

2.0.0.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

06/09 2017

1.0.6

1.0.6.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

18/07 2017

1.0.5

1.0.5.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

07/11 2016

1.0.4

1.0.4.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

07/11 2016

1.0.3

1.0.3.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

27/11 2015

1.0.2

1.0.2.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

27/11 2015

1.0.1

1.0.1.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener

27/11 2015

1.0.0

1.0.0.0 https://github.com/mbarwick83/shorty

Google Url Shortener API Package for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Barwick

laravel api url google shortener