2017 © Pedro Peláez
 

library tiny

Provides generation and serving of shortened URLs in a Laravel application.

image

viewflex/tiny

Provides generation and serving of shortened URLs in a Laravel application.

  • Monday, June 11, 2018
  • by viewflex
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Tiny

GitHub license, (*1)

Provides generation and serving of shortened URLs in a Laravel application., (*2)

Overview

Basic Steps

  • Install this package in your Laravel application.
  • Run the database migration to create the table for storing URLs.
  • Add URLs manually via the web UI, or programatically via the TinyService class.

Architecture

All interaction with the database is handled by a repository class implementing the TinyQueryInterface (by default, the TinyQuery class). The concrete query class is bound via the package configuration, so it's easy to create and deploy a new query class for an alternate data source (NoSQL, key-value store, etc), without hacking the package itself., (*3)

Installation

From your Laravel application's root directory, install via Composer:, (*4)

composer require viewflex/tiny

Add the TinyServiceProvider to the list of providers in config/app.php. Note: This is not necessary when using Laravel 5.5 or greater with package discovery enabled., (*5)

Viewflex\Tiny\TinyServiceProvider::class,

Migration

Laravel 5.4 or greater can run the migration directly from the package., (*6)

php artisan migrate

For older versions of Laravel, publish the migration first., (*7)

php artisan vendor:publish  --tag='tiny-data'

Configuration

The tiny.php config file contains the package settings., (*8)

'caching'       => [
    'active'        =>  true,
    'minutes'       =>  1440
],

'query'         => '\Viewflex\Tiny\Queries\TinyQuery',

'tables'        => [
    'urls'          => 'tiny_urls'
]

If you need to customize the configuration, run this command to publish the config file to the project's config directory:, (*9)

php artisan vendor:publish  --tag='tiny'

This will also publish the UI view template to your project's resources/views/vendor/tiny directory. Unless you need to customize one of these files it is not necessary to publish them., (*10)

Caching

By default, URL lookups are cached, which greatly increases performance. You can disable this or change the cache lifetime to suit your needs., (*11)

Query

This is the repository class that interacts with the data source. Any class implementing the TinyQueryInterface can be used in place of the default, as needed., (*12)

Tables

Here the table name is aliased, to allow using whatever table name you want without hacking the package., (*13)

Usage

Adding URLs

The TinyController provides a UI for adding URLs. Simply enter a URL and click the Save button. The URL will be displayed along with it's alias in the resulting message. The route <mydomain>/tiny/create is used to access the UI from a web browser. It is also quite easy to integrate the TinyService class into your own code, to generate and store URLs programatically., (*14)

Serving URLs

Once stored, a URL can be accessed via the <mydomain>/tiny/{hash} package route. Of course, if necessary you can also create an additional route to hit the same controller method., (*15)

Tests

Tests can be run in the usual way, as described in the test documentation., (*16)

License

This software is offered for use under the MIT License., (*17)

The Versions

11/06 2018

dev-master

9999999-dev

Provides generation and serving of shortened URLs in a Laravel application.

  Sources   Download

MIT

The Requires

 

by Adam Sailor

laravel url shortener url encoder shortened url server

11/06 2018

dev-develop

dev-develop

Provides generation and serving of shortened URLs in a Laravel application.

  Sources   Download

MIT

The Requires

 

by Adam Sailor

laravel url shortener url encoder shortened url server

11/06 2018

1.0

1.0.0.0

Provides generation and serving of shortened URLs in a Laravel application.

  Sources   Download

MIT

The Requires

 

by Adam Sailor

laravel url shortener url encoder shortened url server

10/06 2018

1.0-a1

1.0.0.0-alpha1

Provides generation and proxy of shortened URLs in a Laravel application.

  Sources   Download

MIT

The Requires

 

by Adam Sailor

laravel url shortener url encoder url proxy