dev-master
9999999-devTiny URL Shortener
MIT
The Requires
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Tiny URL Shortener
Wash is tiny url shortener composer package that will store a url and return a tiny url from a JSON REST API request., (*1)
It is build to work from the index file and will identify a tiny url and redirect or else continue with your regular website. Some .htaccess magic might be required though., (*2)
I use this together with a keyword workfow in Alfred that will copy the shortened url to clipboard., (*3)
Wash can also be used with the Wash Android App, (*4)
Hits on shortened url will create a pageview in Google Analytics., (*5)
Wash is available on Packagist, (*6)
This is built for my own use as I happen to own a super short domain and needed something self-hosted., (*7)
/Peter, (*8)
POST Payload:, (*9)
{
"token": "TOKEN",
"url": "http://wa.se"
}
Return:, (*10)
http://wa.se/s5f4
Error response:, (*11)
{
"status": 0,
"errorMsg": "Descriptive error message"
}
curl —X POST -d '{ "token": "TOKEN","url": "http://wa.se" }' http://wa.se/
Add this to composer.json:, (*12)
"require": {
"pean/wash": "dev-master",
},
Create the tables from tables.sql and then do this:, (*13)
Set up .htaccess something like this:, (*14)
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9]+)$ index.php [L]
And the run everything:, (*15)
$wash = new Pean\Wash(
array(
'db' => array (
'host' => 'localhost',
'user' => 'root',
'passw' => '',
'db' => 'wa',
),
'salt' => '[something salty]',
'ga' => array (
'id' => 'UA-12345-6',
'site' => 'wa.se'
),
'test' => '0',
'pushbullet' = array(
'token' => '658a17ac3a4ce4b2e80887347a2caf8a'
)
)
);
Tiny URL Shortener
MIT