sfShortUrlPlugin - 0.1

A free implementation of an url shortening service.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
This plugin is deprecated and is not maintained anymore. Please prefer the Doctrine version sfDoctrineShortUrlPlugin
Show source

sfShortUrlPlugin

Introduction

This in a free implementation of a url shortening service. A demonstration is available on xav.cc.

Features

  • url shortening
  • url validation
  • custom keyword support
  • public/private shortened urls
  • supports Symfony 1.2

Installation guide

  • go to your project's root

  • Install the plugin:

     ./symfony plugin:install sfShortUrlPlugin
    
  • edit the project configuration in order to enable it,

  • activate the "sfShortUrl" module in your app's settings.yml:

     enabled_modules:   [default, sfShortUrl]
    
  • rebuild the model:

     ./symfony propel:build-all
    
  • clear the cache:

     ./symfony cc
    

Usage

Default routes

The default configuration does not enable the plugin's routes:

  • /:shorturl
  • /list/*
  • /

If you want to enable it, juste add the following parameter in the app.yml file:

all:
  sfShortUrlPlugin:
    use_routes:   true

Else, you'll have to create three routes :

  sfShorturl_homepage:
    url:   /shorturl
    param: { module: sfShortUrl, action: index }

  sfShorturl_list:
    url:   /shorturl/list/*
    param: { module: sfShortUrl, action: list }

  sfShorturl:
    url:   /shorturl/:shorturl
    param: { module: sfShortUrl, action: shorturl }

Parameters

The url shortening form displays three fields:

  • url to shorten
  • your keyword: a facultative keyword to use as the short url
  • is_public: whether or not the url should be publically displayed

API

The plugins also allows programmatic url shortening:

<?php
$uri = 'http://lacot.org/';
$shorturl = 'me';
$is_public = true;
$shorturl_object = sfShortUrlPeer::sfShortUrlPeer::generate($uri, $shorturl, $is_public);

echo url_for('@sfShorturl?shorturl='.$shorturl_object->getShortUrl(), true);

This will display: http://domain.tld/me

Roadmap / whishlist

  • better shorturl keyword generation algorithm
  • RSS feeds
  • API
  • mass url shortening
  • ajax support
  • ability to disable the links public list

License and credits

This plugin has been developed by Xavier Lacot and is licensed under the MIT license. Please send comments, patches and suggestions to xavier [at] lacot.org

Changelog

version 0.1 - 2009-05-10

Initial public release. Features basic url shortening and custom keywords.