mparaiso/urlshortenerappserviceprovider
Composer 安装命令:
composer require mparaiso/urlshortenerappserviceprovider
包简介
Url Shortener App Service provider
README 文档
README
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.
author : MParaiso
contact: mparaiso@online.fr
status: work in progress
Installation
database:
you can use the file database/db.sql or use the doctrine console
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
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 ...
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-03-27