2017 © Pedro Peláez
 

library url-shortener

URL shortening the easy way.

image

vinelab/url-shortener

URL shortening the easy way.

  • Wednesday, December 23, 2015
  • by Mahmoudz
  • Repository
  • 8 Watchers
  • 52 Stars
  • 7,254 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 17 Forks
  • 9 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

URL Shortener PHP Package

Latest Stable Version Latest Unstable Version Total Downloads Build Status Scrutinizer Code Quality License, (*1)

vinelab/url-shortener is a PHP framework agnostic Package that makes it easy to shorten your URL's, with your favourite URL Shortening provider such as (Bit.ly, Goo.gl, Ow.ly)., (*2)

The URL Shortening Providers are online services that takes long URLs and squeezes them into fewer characters to make the link easier to share, tweet, or send by email., (*3)

The package requires PHP 5.4+ and comes bundled with a Laravel 5 Facade and a Service Provider to simplify the optional framework integration and follows the FIG standard PSR-4 to ensure a high level of interoperability between shared PHP code and is fully unit-tested., (*4)

Highlights

Installation

The recommended way to install this package is via Composer., (*5)

Via Composer

A. Run this composer command:, (*6)

    composer require vinelab/url-shortener:*

B. Or manually add the package to your composer.json and run composer update., (*7)

    {
        "require": {
            "vinelab/url-shortener": "*"
        }
    }

Integrations

url-shortener is framework agnostic and as such can be integrated easily natively or with your favorite framework., (*8)

Laravel:

The url-shortener package has optional support for Laravel 5 and it comes bundled with a Service Provider for easier integration., (*9)

After you have installed the package correctly, just follow the instructions., (*10)

.1. Register the service provider in your config/app.php:, (*11)

    'providers' => array(
        ...
        'Vinelab\UrlShortener\UrlShortenerServiceProvider'
    ),

The service provider will automatically alias the Vinelab\UrlShortener\Shorten class, so you can easily use the Shorten facade anywhere in your app., (*12)

.2. Publish the configuration file:, (*13)

php artisan vendor:publish --provider ='Vinelab\UrlShortener\UrlShortenerServiceProvider'

Configuration

.1. Open url-shortener.php and select your default provider:, (*14)

    'default' => 'bitly',

.2. Then add your provider token:, (*15)

        'bitly' => [
            'domain' => 'https://api-ssl.bitly.com',
            'endpoint' => '/v3/shorten',
            'token' => 'YOUR-TOKEN-HERE',
        ],

Note: It's very recommended to not add your token (any sensetive data) to the config file instead reference it to a .env variable., (*16)

And to do so:, (*17)

  1. replace the 'token' => 'YOUR-TOKEN-HERE', with 'token' => env('BITLY_TOKEN'),, (*18)

  2. open your .env file and add the token variable there with the token value: BITLY_TOKEN=YOUR-TOKEN-HERE., (*19)

  3. add the variable BITLY_TOKEN= to the .env.example for other developers., (*20)

Usage

With Laravel:

The easiest way is to use it is by the Shorten facade., (*21)

$long_url = 'http://testing.tst/something/12345/something-else/54321';

$short_url = Shorten\Shorten::url($long_url); // returns the short version of the long_url as a string

Test

To run the tests, run the following command from the project folder., (*22)

$ ./vendor/bin/phpunit

Contributing

Support new provider

To add support for a new URL shortening provider:, (*23)

  1. write a driver for your URL Shortener service. check the Bitly driver Vinelab\UrlShortener\Drivers\Bitly class.
  2. add you driver configuration to the config file.
  3. write tests for your drvier.
  4. update the README file
  5. check out the Contribution Guide for general details.

Support

On Github, (*24)

Security

If you discover any security related issues, please email abed.halawi@vinelab.com instead of using the issue tracker., (*25)

Credits

License

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

The Versions

23/12 2015

dev-master

9999999-dev

URL shortening the easy way.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel url bitly bit.ly url shortener shorten url-shortener

23/12 2015

v1.2.0

1.2.0.0

URL shortening the easy way.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel url bitly bit.ly url shortener shorten url-shortener

25/05 2015

v1.1.1

1.1.1.0

URL shortening the easy way.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel url bitly googl bit.ly url shortener goo.gl shorten ow.ly url-shortener owly

24/05 2015

v1.1.0

1.1.0.0

URL shortening the easy way.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel url bitly googl bit.ly url shortener goo.gl shorten ow.ly url-shortener owly

11/05 2015

1.0.0

1.0.0.0

Shorten your URL the easy way.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel url php bitly url shortener shorten