2017 © Pedro Peláez
 

library urlshortenerappserviceprovider

Url Shortener App Service provider

image

mparaiso/urlshortenerappserviceprovider

Url Shortener App Service provider

  • Thursday, March 28, 2013
  • by Mparaiso
  • Repository
  • 0 Watchers
  • 0 Stars
  • 19 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Url Shortener App Service provider

Build Status, (*1)

Create shortened URL , redirect your users to these urls , bootstrap 2.* ready !

this provider provides your application a complete url shortener service for your application , backed by doctrine ORM., (*2)

author : MParaiso, (*3)

contact: mparaiso@online.fr, (*4)

status: work in progress, (*5)

Installation

database:, (*6)

you can use the file database/db.sql or use the doctrine console, (*7)

    php console.php orm:schema-tool:create

Basic usage:

    $autoload = require __DIR__ . "/../vendor/autoload.php";
    !defined("ROOT") AND define("ROOT", __DIR__);
    $app = new \Silex\Application;
    $app['debug']=true;
    $app->register(new MonologServiceProvider, array('monolog.logfile' => ROOT.'/log.txt'));
    $app->register(new UrlGeneratorServiceProvider);
    $app->register(new ValidatorServiceProvider);
    $app->register(new ConsoleServiceProvider);
    $app->register(new SessionServiceProvider);
    $app->register(new TranslationServiceProvider);
    $app->register(new TwigServiceProvider);
    $app->register(new FormServiceProvider);
    $app->register(new DoctrineServiceProvider, array(
        "db.options" => array(
            "path"   => ROOT . "/db.sqlite",
            "driver" => "pdo_sqlite",
        )
    ));
    $app->register(new DoctrineORMServiceProvider);
    $app->register(new UrlShortenerAppServiceProvider);
    $app->mount("/", $app['url_shortener.controller']));

Basic API

  • GET "/" : url shortener form
  • POST "/" : create a new short url
  • GET "/{identifier}" : redirect to an shortened url according to its identifier

You can change the root route by mounting $app['url_shortener.controller'] to a custom route, (*8)

services

  • url_shortener.ns : the namespace ( by default url_shortener )
  • url_shortener.controller : the controller
  • url_shortener.shortener_service : a shorten service for data persistance
  • url_shortener.country_service : a country service for country/ip detection , etc ...

The Versions