Simpler Url Shortener for Laravel

Overview

Laravel Url Shortener

Laravel Url Shortener

Software License Package Size

"Buy Me A Coffee"

Install

composer require magarrent/laravel-url-shortener

Run migrations:

php artisan migrate


Configuration

If you want to configurate some package parameters, run vendor publish:

php artisan vendor:publish --provider="Magarrent\LaravelUrlShortener\LaravelUrlShortenerServiceProvider"


Usage

Import the UrlShortener in your php file.

use Magarrent\LaravelUrlShortener\Models\UrlShortener;

Then you can use the Url shortener package to redirect internal and external links.

UrlShortener::generateShortUrl("https://www.kodio.tech")

UrlShortener::generateShortUrl("/my-next/local/page")

Ex. Redirection:

https://your.url/H8g9Jx => https://www.kodio.tech


You only have to send the Url To param to the UrlShortener model:

public  static  function  generateShortUrl(String $toUrl):  String

Roadmap

  • Ask me for more features! You can buy me a coffe too :)

Changelog

1.0.2

  • Add getOriginalUrlFromKey function to model
  • Added configuration for Url key length

1.0 - First version

Contributing

Please see CONTRIBUTING for details.

Credits

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

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

You might also like...
A modern, powerful, and robust URL shortener
A modern, powerful, and robust URL shortener

🚡 A modern, minimalist, and lightweight URL shortener. Polr is an intrepid, self-hostable open-source link shortening web application with a robust A

Laravel based API to shorten URLs and share them easily. Redirects to the real URL by entering a short URL generated by the API

URL Shortener Requirements: PHP 7.4 or above composer node / npm Installation clone the project from the Github repository, enter the project folder,

Um encurtador de URL's gratuito e Open source. Torne suas URL's um tanto pequenas forma rápida e gratuita

Slim Framework 4 Skeleton Application Use this skeleton application to quickly setup and start working on a new Slim Framework 4 application. This app

Laravel URL Localization Manager - [ccTLD, sub-domain, sub-directory].
Laravel URL Localization Manager - [ccTLD, sub-domain, sub-directory].

Laravel URL Localization - (ccTLD, sub-domain, sub-directory). with Simple & Easy Helpers. Afrikaans Akan shqip አማርኛ العربية հայերեն অসমীয়া azərbayca

Purl is a simple Object Oriented URL manipulation library for PHP 7.2+

Purl Purl is a simple Object Oriented URL manipulation library for PHP 7.2+ Installation The suggested installation method is via composer: composer r

Enables the possibility generating sanitized URL parts from persisted patterns.

#Persisted sanitized pattern mapping What does it do? Enables the possibility generating sanitized URL parts from persisted patterns. How does it work

Checking an arbitrary URL for Micro-Framework HLEB

Checking an arbitrary URL for Micro-Framework HLEB The class RouteFinder is not included in the original configuration of the framework HLEB, so it mu

A laravel package for generating Bitly short URLs.

Laravel Bitly Package A laravel package for generating Bitly short URLs. For more information see Bitly Requirements Laravel 5.1 or later Installation

A Laravel package to shorten urls
A Laravel package to shorten urls

Laravel Short Url Laravel Short Url is a package allowing you to shorten urls. Installation With composer composer require gallib/laravel-short-url t

Comments
  • Laravel 9

    Laravel 9

    While installing, I got an error. I assume it's because the site I'm working on was created using Laravel 9

    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - magarrent/laravel-url-shortener[1.0, ..., 1.0.4] require illuminate/support ^7.0|^8.0 -> found illuminate/support[v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
        - Root composer.json requires magarrent/laravel-url-shortener ^1.0 -> satisfiable by magarrent/laravel-url-shortener[1.0, ..., 1.0.4].
    
    You can also try re-running composer require with an explicit version constraint, e.g. "composer require magarrent/laravel-url-shortener:*" to figure out if any version is installable, or "composer require magarrent/laravel-url-shortener:^2.1" if you know which you need.
    
    opened by rherring 2
  • Bitbucket Pipeline error

    Bitbucket Pipeline error

    Unfortunately after adding the package "magarrent/laravel-url-shortener" I've encountered the following problem with Bitbucket Pipeline build:

    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php https://bitbucket.org/censored/src/6d017547e680cb4ff20585b5647ceda95eb7dc16/artisan package:discover --ansi
    
       Illuminate\Database\QueryException 
    
      SQLSTATE[HY000] [1045] Access denied for user 'forge'@'127.0.0.1' (using password: NO) (SQL: select * from information_schema.tables where table_schema = forge and table_name = url_shorteners and table_type = 'BASE TABLE')
    
      at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
        708▕         // If an exception occurs when attempting to run a query, we'll format the error
        709▕         // message to include the bindings with SQL, which will make this exception a
        710▕         // lot more helpful to the developer instead of just the database's errors.
        711▕         catch (Exception $e) {
      ➜ 712▕             throw new QueryException(
        713▕                 $query, $this->prepareBindings($bindings), $e
        714▕             );
        715▕         }
        716▕     }
    
      1   [internal]:0
          Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Magarrent\LaravelUrlShortener\LaravelUrlShortenerServiceProvider))
    
          +23 vendor frames 
      25  [internal]:0
          Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Magarrent\LaravelUrlShortener\LaravelUrlShortenerServiceProvider))
    Script @php https://bitbucket.org/censored/src/6d017547e680cb4ff20585b5647ceda95eb7dc16/artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
    

    Any suggestions how to stop it hitting database during artisan package:discover call?

    opened by HappySoft 6
Releases(1.0.5)
Owner
Marc Garcia Torrent
Full Stack Web developer. Laravel lover
Marc Garcia Torrent
URL shortener web application based on the Laravel PHP Framework.

UrlHub Warning: UrlHub is still in development, constantly being optimized and isn't still stable enough to be used in production environments. Whatev

Kei 349 Jan 4, 2023
URL shortener web application based on the Laravel PHP Framework.

UrlHub Warning: UrlHub is still in development, constantly being optimized and isn't still stable enough to be used in production environments. Whatev

Kei 348 Dec 23, 2022
:aerial_tramway: A modern, powerful, and robust URL shortener

?? A modern, minimalist, and lightweight URL shortener. Polr is an intrepid, self-hostable open-source link shortening web application with a robust A

Chaoyi Zha 4.6k Jan 1, 2023
A simple URL shortener for PHP

Shorty Shorty is a simple URL shortener for PHP. Installation 1. Download and extract the files to your web directory. 2. Use the included database.sq

Mike Cao 210 Dec 19, 2022
A PHP-based self-hosted URL shortener that can be used to serve shortened URLs under your own custom domain.

A PHP-based self-hosted URL shortener that can be used to serve shortened URLs under your own custom domain. Table of Contents Full documentation Dock

null 1.7k Dec 29, 2022
🔗 Your Own URL Shortener

Your Own URL Shortener YOURLS is a set of PHP scripts that will allow you to run Your Own URL Shortener, on your server. You'll have full control over

YOURLS 8.8k Jan 3, 2023
A URL shortener with various other utilities, backed by a custom lightweight framework.

da.gd What is da.gd? da.gd is both a URL shortener and a collection of quick-info tools written in PHP. It allows you to use curl (or any http client)

da.gd 76 Jan 2, 2023
A simple but powerful URL shortener

UrlShorter 这是一个足够简洁的Url短网址生成器 This is a simple Url shorter. 兼容性 在PHP7.X 与 PHP 8.0 下测试通过 安装 step 1: git clone [email protected]:soxft/UrlShorter.git step

xcsoft 74 Dec 21, 2022
URL - link shortener based on sqlite

link-url-shortener url - link shortener based on sqlite.

Okin On 1 Nov 12, 2021
The modern, privacy-aware URL Shortener built in PHP.

About UrlHum UrlHum is a modern, privacy-aware and fast URL Shortener built with PHP and the Laravel Framework. At the moment UrlHum is heavily under

UrlHum 622 Jan 7, 2023