Download the PHP package roddy/url-shortener without Composer

On this page you can find all versions of the php package roddy/url-shortener. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package url-shortener

Table of Contents

Overview

A Laravel package that can be used for adding shortened URLs to your existing web app.

Installation

Quick note: You must have a basic understanding of the use of the artisan command and composer for installing laravel package.

Requirements

The package has been developed and tested to work with the following minimum requirements:

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:

Migrate the Database

This package contains a migration that add a new table to the database: . To run this migration, simply run the following command:

Usage

Generating Shortened URLs

Start

There are two(2) ways to start using url-shortener

Schedule when the url can be access

By default, all short URLs that you generate can be access on the day you generated it. However, you may set a date for accessing your URLs when you're generating them. You can do this by using the method. The method accepts number of days as the parameter and it must be .

Exapmles:

  1. This example will store the generated shortened url with the schedule date into the database;

    1. This example will generated a shortened url with the schedule date without storing it into the database;

Generate a QrCode Image for Short Url

You can generate a QrCode image for your short url by using the method. Note: This method generate an image url for the QrCode, example of the image url data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAAClCAIAAACyS. Note: You can not use and at the same time, you have to use only one of them.

Examples of usage:

  1. This example will store the generated shortened url with the generated QrCode Image into the database;

    1. This example will generated a shortened url with the generated QrCode Image without storing it into the database;

Generate a QrCode Svg for Short Url

You can generate a QrCode svg for your short url by using the method. Note: You can not use and at the same time, you have to use only one of them.

Examples of usage:

  1. This example will store the generated shortened url with the generated QrCode Svg into the database;

    1. This example will generated a shortened url with the generated QrCode Svg without storing it into the database;

    Rules for Generating Shortened URLs

  2. You can not use and at the same time, you have to use only one of them.
  3. The method should always be the last method.
  4. The method accepts only int/number as the days parameter.

Retrieving Url

Find by Id

To find the ShortURL model that corresponds to a given shortened URL id, you can use the method.

For example, to find the ShortURL model of a shortened URL that has the id , you could use the following:

Find by URL Key

To find the ShortURL model that corresponds to a given shortened URL key, you can use the method.

For example, to find the ShortURL model of a shortened URL that has the key , you could use the following:

Find by Original URL

To find the ShortURL model that corresponds to a given shortened URL original Url, you can use the method.

For example, to find all of the ShortURL models of shortened URLs with original url of , you could use the following:

Find Where

To find the ShortURL model that corresponds to a given custom query or filter, you can use the method.

For example, to find all shortened url you could use the following:

Note: the method takes 3 parameters, which are , you can set the parameter to if you don't want to provide an . Example:

Get all URLs

To get all Shortened URL, you can use the method.

Example:

Deleteing Url

Note: All the delete methods returns an array.

Delete by id

To delete the ShortURL model that corresponds to a given shortened URL id, you can use the method.

For example, to delete the ShortURL model of a shortened URL that has the id , you could use the following:

Delete by URL Key

To delete the ShortURL model that corresponds to a given shortened URL key, you can use the method.

For example, to delete the ShortURL model of a shortened URL that has the key , you could use the following:

Delete by Original URL

To delete the ShortURL model that corresponds to a given shortened URL original url, you can use the method.

For example, to delete the ShortURL model of a shortened URL that has the original url , you could use the following:

Delete Where

To delete the ShortURL model that corresponds to a given custom query or filter, you can use the method.

For example, to delete all shortened url you could use the following:

Note: the method takes 3 parameters, which are , you can set the parameter to if you don't want to provide an . Example:

Get Instance of Model

urlShortenerDB

urlShortenerDB returns the urlShortener Model which allows you to use all the methods provided by Laravel. To see the Eloquent methods click https://laravel.com/docs/10.x/eloquent.

Example of Usage:

Security

If you find any security related issues, please contact me directly at [email protected] to report it.

Contribution

If you wish to make any changes or improvements to the package, feel free to make a pull request.

Credits

License

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


All versions of url-shortener with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
chillerlan/php-qrcode Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package roddy/url-shortener contains the following files

Loading the files please wait ....