Download the PHP package orlovtech/short-link without Composer
On this page you can find all versions of the php package orlovtech/short-link. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download orlovtech/short-link
More information about orlovtech/short-link
Files in orlovtech/short-link
Package short-link
Short Description Link shortener package for Laravel
License MIT
Informations about the package short-link
Laravel Link Shortener
Table of Contents
- Overview
- Installation
- Requirements
- Install the Package
- Publish the Config and Migrations
- Migrate the Database
- Generate the Link
- Use the link
- Testing
- License
Overview
A Laravel package that can be used for adding shortened URLs to your existing web app.
Installation
Requirements
The package has been developed and tested to work with the following minimum requirements:
- PHP >=8.1
- Laravel >=9.0
Install the Package
You can install the package via Composer:
Publish the Config and Migrations
You can then publish the package's config file and database migrations by using the following command:
at this config file you can change the prefix you want to use. By default it's a /short/
.
Migrate the Database
This package contains one migration that add a new table to the database: . To run this migration, simply run the following command:
Generate the Link
The fastest way to generate new link is to use the facade OrlovTech\ShortLink\Facades\ShortLink
like this:
This method will return you short version of your link.
Method generate
also has the second parameter singleUse
as an option.
With this parameter you can specify that your link should be deleted after it was used for the first time.
So the full view might be:
To show ready link use param default_short_url
like so:
Use the link
When you have ready link you can use the endpoint https://yourdomain.com/short/628ac418-865a
where short
is the prefix from config file
Testing
To run the package's unit tests, run the following command:
License
The MIT License (MIT). Please see License File for more information.
All versions of short-link with dependencies
illuminate/container Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0