This plugin is deprecated and is not maintained anymore.
Please prefer the Doctrine version sfDoctrineShortUrlPlugin
sfShortUrlPlugin
0.1beta
for sf 1.2 and Propel
MIT
sfShortUrlPlugin provides all the functionnalities of a short url service similar to tinyURL:
- url shortening
- url validation
lease note that this is a work in progress, which can be used at a startpoint in the implementation of a url shortener using symfony.
The Doctrine version of this plugin is sfDoctrineShortUrlPlugin, which is a much more active project, used on http://xav.cc/
Developers
License
Copyright (c) 2009 Xavier Lacot <xavier@lacot.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.1beta
|
MIT |
0.1beta
|
10/05/2009 |
Changelog for release 0.1 - 10/05/2009
Initial public release. Features basic url shortening and custom keywords.
Other releases
Release 0.1 - 10/05/2009
Initial public release. Features basic url shortening and custom keywords.
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:
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.