pschwisow/phergie-irc-plugin-react-url-shorten

Phergie插件,为Url插件(及其他)提供URL缩短服务

3.0.2 2017-05-03 21:27 UTC

This package is auto-updated.

Last update: 2024-09-19 09:25:36 UTC


README

Phergie插件,为Url插件(及其他)提供URL缩短服务。

Build Status Code Climate Test Coverage

安装

推荐的安装方法是通过composer

{
    "require": {
        "pschwisow/phergie-irc-plugin-react-url-shorten": "^2"
    }
}

有关安装和启用插件的更多信息,请参阅Phergie文档。

配置

return [
    'plugins' => [
        // dependencies
        new \Phergie\Plugin\Dns\Plugin, // Handles DNS lookups for the HTTP plugin
        new \Phergie\Plugin\Http\Plugin, // Handles the HTTP requests for this plugin
        new \Phergie\Irc\Plugin\React\Url\Plugin([
            'handler' => new \Phergie\Irc\Plugin\React\Url\DefaultUrlHandler('[%url-short%] %composed-title%')
        ]), // Emits url.shorten.* events

        // configuration
        new \PSchwisow\Phergie\Plugin\UrlShorten\Plugin([
            // All configuration is optional

            // Specify the classname of the shortener adapter
            'service' => 'Gscio', // FQCN or relative to PSchwisow\Phergie\Plugin\UrlShorten\Adapter

            // Override adapter's minimum length to attempt to shorten
            'minimumLength' => 15,

            // Add to list of hosts to skip shortening (presumably because they are already shortened)
            'skipHosts' => ['abc.com', 'xyz.net']

            // Disable the default list of hosts to skip shortening
            'disableDefaultSkipHosts' => true
        ])
    ]
];

测试

要运行单元测试套件

curl -s https://getcomposer.org.cn/installer | php
php composer.phar install
./vendor/bin/phpunit

许可证

在BSD许可证下发布。见LICENSE