URL shortener for Laravel apps...
Get via composer
composer require laravel-ready/url-shortener
php artisan vendor:publish --tag=url-shortener-config
# publish migrations
php artisan vendor:publish --tag=url-shortener-migrations
# apply migrations
php artisan migrate --path=/database/migrations/laravel-ready/url-shortener
use LaravelReady\UrlShortener\Enums\ShortingType;
use LaravelReady\UrlShortener\Supports\UrlShortener;
$shortUrl = UrlShortener::shortUrl(
'https://github.com/laravel-ready/url-shortener',
[
'title' => 'TEST TITLE',
'description' => 'Lorem ipsum dolar amet',
],
ShortingType::Emoji
);
To see all validation rules, see the CreateShortUrlRequest class.
use LaravelReady\UrlShortener\Requests\CreateShortUrlRequest;
class ShortUrlController extends Controller
{
public function store(CreateShortUrlRequest $request)
{
$validateData = $request->validated();
$shortUrl = UrlShortener::shortUrl(
$validateData['url'],
$validateData['meta'] ?? [],
$validateData['type'] ?? ShortingType::Random
);
}
}
You can reach postman examples here.
- This project was generated by the packager.