Download the PHP package binary-cats/laravel-url-shortener without Composer

On this page you can find all versions of the php package binary-cats/laravel-url-shortener. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-url-shortener

Url Shortener for Laravel

Powerful URL shortening tools for your Laravel

Installation

You can easily install this package using Composer, by running the following command:

Requirements

This package has the following requirements:

Laravel 8+

If you use Laravel 8 you must have PHP 7.3 or higher (which is a root laravel requirment)

Laravel 5.5+

If you use Laravel 5.5 or higher, that's it. You can now use the package, continue to the usage section.

Laravel 5.1-5.4

If you're using an older version of Laravel, register the package's service provider to your application. You can do this by adding the following line to your config/app.php file:

Configuration

If you want to change the default configuration, you can publish it with:

The package will expose the following config file:

Below is the full list of .env values to configure:

Usage

The shortener can be retrieved from the container in two ways:

Once you have an instance of the shortener, you can shorten your URLs:

This package relies on Guzzle's promise library for its asynchronous shortening, read their documentation for more information.

You can also use dependency injection to inject the shortener into a method:

The shortener exposes the following methods:

Method Description
shorten Shorten the given URL
shortenAsync Shorten the given URL asynchronously
driver Retrieve a driver (e.g. tiny_url)
extend Register your own driver

Changing the driver

You can change the default driver by setting URL_SHORTENER_DRIVER={driver} in your environment file or publishing the config file and changing it directly.

Adding your own drivers

Much like all of Laravel, you can add your own drivers for this package. You can do this by adding the following code to boot method of your AppServiceProvider.

Once you have registered your driver you can call it just like any other driver.

If you wrote a custom driver that others might find useful (such as a public online shortener service), please consider adding it to the package via a pull request.

Available drivers

Below is a list of available drivers along with their individual specs:

Service Driver name Since version Analytics Monetization
Bit.ly bit_ly 0.1.0 yes no
Firebase Dynamic Links firebase 0.2.0 yes no
Is.gd is_gd 0.2.0 yes no
Ouo.io ouo_io 0.2.0 yes yes
Polr polr 0.3.0 yes no
Shorte.st shorte_st 0.1.0 yes yes
TinyURL tiny_url 0.1.0 no no
V.gd is_gd 0.2.0 yes no

Bit.ly

website

This driver runs on Bit.ly's API and currently only supports API version 4. The API requires an access token and currently only generic access tokens are supported. You can retrieve such tokens from your Bit.ly profile. If you have a paid Bit.ly account you will also be able to set the domain for your shortened URLs.

Variable Description
URL_SHORTENER_API_TOKEN Your Bit.ly API token
URL_SHORTENER_PREFIX Your short URL domain

Firebase Dynamic Links

website

This driver runs on Firebase's API. The API requires an access token, a URI prefix and a suffix. You can access these information on you firebase console. The token accessible under the project settings as "Web API Key" and the prefixes can be defined and accessed under the Dynamic Links menu.

The suffix can have the value SHORT or UNGUESSABLE.

IMPORTANT! Links created via the API are not visible in the Firebase console. They are only accessible via the Analytics REST API.

Variable Description Default
URL_SHORTENER_API_TOKEN Your Firebase API token
URL_SHORTENER_PREFIX Your URL prefix
URL_SHORTENER_STRATEGY The path component creation method UNGUESSABLE

Is.gd / V.gd

website

This driver supports is.gd and v.gd trough their respective APIs. When link previews are enabled v.gd will be used, otherwise is.gd will be used.

Variable Description
URL_SHORTENER_ANALYTICS Enable or disable statistics

Ouo.io

website

This driver uses the Ouo.io API and requires an access token. The API allows for URL monetization via advertisements and provides analytics via its dashboard.

Variable Description
URL_SHORTENER_API_TOKEN Your Ouo.io API token

Polr

website

This driver uses the Polr API. The API requires an access token and a URI prefix.

Variable Description
URL_SHORTENER_API_TOKEN Your Polr API token
URL_SHORTENER_PREFIX Your URL prefix

Shorte.st

website

This driver uses the Shorte.st API, which requires an access token. This API supports monetization of your URLs and can give you insight into your traffic via its dashboard.

Variable Description
URL_SHORTENER_API_TOKEN Your Shorte.st API token

TinyURL

website

This driver runs on the TinyURL API, which requires no additional setup. This driver is the package default.

Changelog

Please see CHANGELOG for more information what has been changed in recent versions.

Security

If you discover any security related issues, please email one of the authors instead of using the issue tracker. You can find the author emails in the composer.json.

Contributing

Please see CONTRIBUTING for details.

Credits

This is a port from the original LaraCraft's Url Shortener.

License

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


All versions of laravel-url-shortener with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
guzzlehttp/guzzle Version ^6.2||^7.0
guzzlehttp/promises Version ^1.0
guzzlehttp/psr7 Version ^1.4
illuminate/support Version ^5.1 || ^6.0 || ^7.0 || ^8.0
psr/http-message Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package binary-cats/laravel-url-shortener contains the following files

Loading the files please wait ....