rezzza / shorty-bundle
Underwear for your long urls in Symfony
Installs: 12 793
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 4
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- rezzza/shorty: ~1.1
- symfony/framework-bundle: ~2.2|~3.0
Requires (Dev)
- atoum/atoum: ~2.0
This package is not auto-updated.
Last update: 2024-04-13 11:28:26 UTC
README
Underwear for your long urls in Symfony.
Integration of Shorty library.
Installation
Use Composer to install: rezzza/shorty-bundle
.
In your composer.json
you should have:
{
"require": {
"rezzza/shorty-bundle": "2.0.*"
}
}
Then update your AppKernel.php
to register the bundle with:
new Rezzza\ShortyBundle\RezzzaShortyBundle()
Configuration
rezzza_shorty:
default_provider: google
providers:
google:
id: google
key: ~
http_adapter: ~ # default is Rezzza\Shorty\Http\CurlAdapter
google2:
id: google
key: anotherkey
bitly:
id: bitly
access_token: ~ #required
http_adapter: ~ # default is Rezzza\Shorty\Http\CurlAdapter
custom:
id: my_custom_service
chain:
id: chain
providers: [google, bitly, custom, google2]
Basic usage
$shorty = $this->container->get('rezzza.shorty.google');
// or
$shorty = $this->container->get('rezzza.shorty'); // will use default_provider.
try {
$short = $shorty->shorten('http://www.verylastroom.net');
$long = $shorty->expand($long);
} catch (\Rezzza\Shorty\Exception\Exception $e) {
// oops ...
}
Exceptions
Exceptions directory.