laravel-ready / url-shortener
Simple URL shortener for laravel apps
v1.2.15
2023-12-27 00:25 UTC
Requires
- php: ^8.1 || ^8.0
- illuminate/support: ^10.3 || ^9.0 || ^8.0
- laravel-ready/hasin: ^2.1
Requires (Dev)
- mockery/mockery: ^1.5.1
- nunomaduro/larastan: ^2.5.1
- orchestra/testbench: ^v8.0.8
- pestphp/pest: ^v1.22.5
- pestphp/pest-plugin-laravel: ^v1.4.0
- pestphp/pest-plugin-parallel: ^v1.2.1
- phpstan/extension-installer: ^1.2.0
- phpstan/phpstan: ^1.10.6
- phpstan/phpstan-deprecation-rules: ^1.1.2
- phpstan/phpstan-phpunit: ^1.3.10
README
📂 About
URL shortener for Laravel apps...
📦 Installation
Get via composer
composer require laravel-ready/url-shortener
⚙️ Configs
php artisan vendor:publish --tag=url-shortener-config
🏗️ Migrations
# publish migrations php artisan vendor:publish --tag=url-shortener-migrations # apply migrations php artisan migrate --path=/database/migrations/laravel-ready/url-shortener
📝 Usage
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 );
CreateShortUrlRequest
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 ); } }
🔗 Postman
You can reach postman examples here.
⚓ Credits
- This project was generated by the packager.