Skip to content

This Googl PHP library allows you to easily generate shortened links using Google's URL shortening service, extremely easy to use and setup

Notifications You must be signed in to change notification settings

srinathweb/Googl-Library-PHP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Googl-Library-PHP

This Googl PHP library allows you to easily generate shortened links using Google's URL shortening service, extremely easy to use and setup. Below I've included detailed setup guides to generate links using their API

Setup

  1. Upload the files to your web server, or what ever other environment you're using.
  2. Go to https://console.developers.google.com/home/dashboard and generate a new key for 'URL Shortening' - you'll need to use this in the constructor of the class
  3. Implement the class, I've included an example project under 'googl_example.php', you can either put your URL in the constructor of the class or set the variable yourself.
// Include the library
require_once "googl.class.php";

// New Googl class
$Googl = new Googl([
  // Our Google API key
  'api_key' => 'YOUR_GOOGLE_API_KEY'
]);

// Display our generated shortened link
echo $Googl->shorten("https://github.com/lloydaaa");

// Shorten several links, put into a one-dimentional array
// Output - ['http://goo.gl/GjcEix', 'http://goo.gl/FxcErx', 'http://goo.gl/rjFxiI']
$links = $Googl->shorten([
  "https://github.com/lloydaaa",
  "https://twitter.com/lloydaaa",
  "https://google.com"
]);

It's as easy as that!

Licence

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

This Googl PHP library allows you to easily generate shortened links using Google's URL shortening service, extremely easy to use and setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%