Git Product home page Git Product logo

laravel-short-url's Introduction

Laravel Short URL logo

Laravel Short Url Build Status StyleCI

Laravel Short Url is a package allowing you to shorten urls.

Installation

With composer

composer require gallib/laravel-short-url

then run

php artisan vendor:publish --provider="Gallib\ShortUrl\ShortUrlServiceProvider"
php artisan migrate

finally, paste ShortUrl::routes(); at the end of routes/web.php

Configuration

Laravel Short Url configuration file can be found on config/shorturl.php

  • blacklist : Allows to blacklist urls. Keywords can be either an url, a keyword or an extension

Advanced configuration

Instead of adding ShortUrl::routes(); you can call three separates methods:

  • ShortUrl::createRoutes(); to shorten urls
  • ShortUrl::manageRoutes(); to manage urls
  • ShortUrl::redirectRoute(); to redirect to the url

this allows you to add middlewares or prefix routes.

Migration Customization

If you are not going to use Short Url's default migrations, you should call the ShortUrl::ignoreMigrations(); method in the register method of your AppServiceProvider. You may export the default migrations using

php artisan vendor:publish --tag=shorturl-migrations

Nice!

Laravel short url is now set up on your homepage.

Credits

laravel-short-url's People

Contributors

caneco avatar claraleigh avatar gallib avatar hernandev avatar pedrosancao avatar yasuakihirano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laravel-short-url's Issues

Proposal : Expiration date

Functionnality proposal :
Add an optional column expires_at.
Then, a daily or weekly cron comes cleanup.

Can be useful for temporary short links. For instance, if we send shortened url by mail to validate the email, it doesn't need to stay in time.

minimum stability issues

There are some depending issues of laravel-short-url package
I have "laravel/framework": "5.7.*".

I am getting issues while I run this command
composer require gallib/laravel-short-url

Problem 1
- gallib/laravel-short-url 1.4.2 requires symfony/dom-crawler ^4.2 -> satisfiable by symfony/dom-crawler[4.2.x-dev, 4.3.x-dev, v4.2.0, v4.2.0-BETA1, v4.2.0-BETA2, v4.2.0-RC1, v4.2.1, v4.2.2, v4.2.3] but these conflict with your requirements or minimum-stability.
- gallib/laravel-short-url 1.4.1 requires illuminate/routing 5.6.* -> satisfiable by illuminate/routing[5.6.x-dev, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9] but these conflict with your requirements or minimum-stability.
- gallib/laravel-short-url 1.4.0 requires illuminate/routing 5.6.* -> satisfiable by illuminate/routing[5.6.x-dev, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9] but these conflict with your requirements or minimum-stability.
- Installation request for gallib/laravel-short-url ^1.4 -> satisfiable by gallib/laravel-short-url[1.4.0, 1.4.1, 1.4.2].

Feature Request: Multi-User Support

Hi there!
I very much like this simple and clean package and would love to use it.
But currently my use case for a multi-user scenario prevents me, because a shortened url is not associated with the user, that authored this url.

It would be just a small extension to add a user_id column to the url table.
That way, we could filter to only show the urls authored by the current user, so that no urls are shown from other users and so that users cannot edit urls from other users.

What do you think about this?
If you do not consider this functionality to be implemented in the package, how could I extend the package myself to match my use case?

Laravel 8

Problem 1
    - Root composer.json requires gallib/laravel-short-url ^1.8 -> satisfiable by gallib/laravel-short-url[1.8.0].
    - gallib/laravel-short-url 1.8.0 requires illuminate/database ^7.30.3|^8.22.1 -> found illuminate/database[v7.30.3, v7.30.4, 7.x-dev, v8.22.1, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.

user_id relation

Laravel as a bigint(20) on the users table.
Your Schema is wrong (now)

$table->integer('user_id')->nullable()->unsigned()->after('expires_at');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.