URENER is a url shortener web application based on laravel. It mainly use automatic dependency injection of Laravel service container to abstract the implementation from high level code. Thanks to Taylor Otwell for this awesome framework. This repository focus on the pricinple of "Code to interface" and SOLID. The features of the application include
- Custom slug on top of the Id generator
- Logging the visitor
- Laravel Passport Authentication
- Caching the url
- Unit Test & Integration Test & Behavior Test
- DNS checker validation
- Pluggable slug generator
- CLI powered administration
Urener is accessible, yet powerful and robust application to make shorten url.
composer install
php artisan migrate
php artisan passport:install
php artisan serve
php artisan passport:client --password
php artisan make:admin
$response = $http->post('http://your-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'username' => '[email protected]',
'password' => 'my-password',
'scope' => '',
],
]);
POST /admin/urls
{
"alias" : "hcm",
"redirect_url" : "https://hinchatmal.com/",
}
Here is a quick start to easily generate and test the app
php artisan db:seed
php artisan urlshortener:list 1
GET /admin/urls
GET /admin/urls/1
POST /admin/urls
{
"alias" : "hcm",
"redirect_url" : "https://hinchatmal.com/",
}
PUT /admin/urls/1
{
"alias" : "hcm",
"redirect_url" : "https://hinchatmal.com/",
}
DELETE /admin/urls/1
php artisan make:admin
php artisan urlshortener:make
php artisan urlshortener:list {page(1,2,3,4)}
Currently the app supports two style for generating random slug "youtube" style short id generator and "uuid" generator, configure it on .env.
ID_GENERATOR="youtube"
By default the application will validate whether provided redirect url is existed on realword or not. To disable that feature, simply set false on .env. (Please not that DNS checking is disabled by default in Testing environment)
DNS_CHECK=false
/vendor/bin/phpunit