https://github.com/sunxyw/unify-shorten
Make all URL Shorteners together
https://github.com/sunxyw/unify-shorten
laravel php shortener unify url url-shortener
Last synced: 3 months ago
JSON representation
Make all URL Shorteners together
- Host: GitHub
- URL: https://github.com/sunxyw/unify-shorten
- Owner: sunxyw
- License: mit
- Created: 2022-10-16T10:40:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T03:53:33.000Z (over 1 year ago)
- Last Synced: 2025-02-05T13:13:07.040Z (4 months ago)
- Topics: laravel, php, shortener, unify, url, url-shortener
- Language: PHP
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Unify Shorten - Make all URL Shorteners together
[](https://packagist.org/packages/sunxyw/unify-shorten)
[](https://github.com/sunxyw/unify-shorten/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/sunxyw/unify-shorten/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/sunxyw/unify-shorten)This is a package that helps you quickly access various short link services, which you can use to make your app support
short links provided by different short link services.
From full disclosure, to requiring registration, and even paid services.## Installation
You can install the package via composer:
```bash
composer require sunxyw/unify-shorten
```You can publish the config file with (it should be published automatically):
```bash
php artisan vendor:publish --tag="unify-shorten-config"
```## Usage
```php
// using Facade
use Sunxyw\Shorten\Facades\Shorten;
Shorten::shorten('AWESOME URL HERE'); // using default provider
Shorten::provider('cuttly')->shorten('AWESOME URL HERE WITH CUTTLY'); // using cuttly provider// using helper function
shorten('AWESOME URL HERE'); // using default provider// using Shorten class
use Sunxyw\Shorten\Shorten;
app(Shorten::class)->shorten('AWESOME URL HERE'); // using default provider
app(Shorten::class)->provider('cuttly')->shorten('AWESOME URL HERE WITH CUTTLY'); // using cuttly provider
app(Shorten::class)->gotiny->shorten('AWESOME URL HERE WITH GOTINY'); // using gotiny provider (using magic property)
```All the methods above will return the shortened URL.
## Supported Providers
| API | Auth | HTTPS | CORS |
|---------------------------------------------------------------|----------|-------|---------|
| [1pt](https://github.com/1pt-co/api/blob/main/README.md) | No | Yes | Yes |
| [CleanURI](https://cleanuri.com/docs) | No | Yes | Yes |
| [Cutt.ly](https://cutt.ly/api-documentation/cuttly-links-api) | `apiKey` | Yes | Unknown |
| [GoTiny](https://github.com/robvanbakel/gotiny-api) | No | Yes | Yes |
| [Firebase](https://firebase.google.com/docs/dynamic-links) | `apiKey` | Yes | Yes |> If you have more providers that you would like supported, please contact me in Issues. For paid providers, it would be
> even better if you could provide test credentials.## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [sunxyw](https://github.com/sunxyw)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.