Laravel Packagist Sponsor

This plugin sets up a provider to allow your Laravel instance to communicate with your own YOURLS installations API and generate the links for you. Eg:

\ShortUrl::shorturl('https://laravel.com')

would return https://mysh.ort/la4sf4

What is YOURLS

YOURLS stands for Your Own URL Shortener. It is a small set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or Bitly).

Running your own URL shortener is fun, geeky and useful: you own your data and don't depend on third-party services. It's also a great way to add branding to your short URLs, instead of using the same public URL shortener everyone uses.

Features

  • Free and open-source software.
  • Private (your links only) or Public (everybody can create short links, fine for an intranet)
  • Sequential or custom URL keywords
  • Handy bookmarklets to easily shorten and share links
  • Awesome stats: historical click reports, referrers tracking, visitors geo-location
  • Neat Ajaxed interface
  • Terrific Plugin architecture to easily implement new features
  • Cool developer API
  • Full jsonp support
  • Friendly installer
  • Sample files to create your own public interface and more

Installation

Install via composer

composer require phpsa/laravel-yourls-plugin

Register Service Provider

Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.

Add service provider to config/app.php in providers section

'providers' => [
    ...
    Phpsa\LaravelYourlsPlugin\ServiceProvider::class,
];

Optionally register the package facade in config/app.php in aliases section

'aliases' => [
    ...
    'ShortUrl' => Phpsa\LaravelYourlsPlugin\Facades\LaravelYourlsPlugin::class,
]

Configuration

You can optionally publish the configuration file by running

php artisan vendor:publish --provider="Phpsa\LaravelYourlsPlugin\ServiceProvider" --tag="config"

or set the settings in your env file by using the following keys

LARAVEL_YOURLS_PLUGIN_URL=
LARAVEL_YOURLS_PLUGIN_USERNAME=
LARAVEL_YOURLS_PLUGIN_PASSWORD=
LARAVEL_YOURLS_PLUGIN_SIGNATURE=
LARAVEL_YOURLS_PLUGIN_FORMAT=json

Authentication can use either the username / password combo or the signature