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
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.
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,
]
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