oza75/laravel-url-shortener

Laravel Package for shortening urls
1,526
Install
composer require oza75/laravel-url-shortener
Latest Version:v0.1.8
PHP:^7.0|^8.0
License:MIT
Last Updated:Mar 18, 2022
Links: GitHub  ·  Packagist
Maintainer: oza75

Latest Stable Version Total Downloads

A minimal Laravel package for shortening URLs. Apart for creating short URLs - like bitly - it also supported updating URL redirects and tracking URL clicks.

Laravel URL Shortener

Install the package. It supports Laravel 5.5 and up (including 7.0 and up).

composer require arietimmerman/laravel-url-shortener
php artisan migrate

And start shortening URLs

(string)URLShortener::shorten("http://www.example.com");

Or

php artisan url:shorten http://www.example.com

Usage for Laravel < 5.5

Add the service provider in your config/app.php.

'providers' => [ /* [..] */ \ArieTimmerman\Laravel\URLShortener\ServiceProvider::class /* [..] */ ];

Optional

Publish the configuration and the view.

php artisan vendor:publish --provider="ArieTimmerman\Laravel\URLShortener\ServiceProvider"

Optionally, register for URLVisit events in your EventServiceProvider.

protected $listen = [
	'ArieTimmerman\Laravel\URLShortener\Events\URLVisit' => [
		'App\Listener\YourListener',
	]
];

Configuration

See config/urlshortener.php

Docker

Build and start the docker container.

docker-compose build
docker-compose up

Now shorten an URL like this

docker-compose exec laravel-url-shortener php artisan url:shorten https://www.example.com

Check out the redirect

curl -v http://localhost:18123/code

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released PHP Laravel License
v0.1.8 ^7.0|^8.0 ^6.0|^7.0|^8.0|^9.0 MIT
v0.1.7 ^7.0|^8.0 ^6.0|^7.0|^8.0|^9.0 MIT
v0.1.6 ^7.0|^8.0 ^6.0|^7.0|^8.0 MIT
v0.1.5 ^7.0|^8.0 ^6.0|^7.0|^8.0 MIT
v0.1.4 ^7.0 ^6.0|^7.0|^8.0 MIT