Download the PHP package tomkyle/kurzelinks without Composer
On this page you can find all versions of the php package tomkyle/kurzelinks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tomkyle/kurzelinks
More information about tomkyle/kurzelinks
Files in tomkyle/kurzelinks
Package kurzelinks
Short Description Link shortener using the kurzelinks.de API. Supports PSR-6 caches and rate limits.
License MIT
Informations about the package kurzelinks
tomkyle/kurzelinks
tomkyle/kurzelinks is a PHP library designed to create short links using the kurzelinks.de service. This library provides different implementations of the KurzeLinksInterface
to allow developers to integrate and extend the short link creation functionality with ease.
Table of Contents
- Installation
- Usage
- GuzzleKurzeLinks
- RateLimitKurzeLinks
- Psr6CacheKurzeLinks
- PassthroughKurzeLinks
- CallableKurzeLinks
- Interface
- KurzeLinksInterface
Installation
You can install this library via Composer:
Usage
GuzzleKurzeLinks
The GuzzleKurzeLinks
class is an implementation of KurzeLinksInterface
that uses GuzzleHTTP to interact with the KurzeLinks.de API.
Example
RateLimitKurzeLinks
The RateLimitKurzeLinks
class is a decorator for any KurzeLinksInterface
implementation. It introduces a rate limit by pausing execution between requests.
Example
Psr6CacheKurzeLinks
The Psr6CacheKurzeLinks
class is a decorator that caches the results of the create
method using a PSR-6 compatible cache pool.
Example
PassthroughKurzeLinks
The PassthroughKurzeLinks
class is a simple implementation of KurzeLinksInterface
that returns the original URL without shortening it. This can be useful for testing or as a default behavior.
Example
CallableKurzeLinks
The CallableKurzeLinks
class is a decorator that allows a KurzeLinksInterface
implementation to be invoked directly as a callable.
Example
Interface
KurzeLinksInterface
The KurzeLinksInterface
defines the contract for creating short links.
Method
create(string $url): string
Creates a short link representation for the given URL.
Example
Any class implementing this interface must define the create
method:
License
This library is licensed under the MIT License. See the LICENSE file for more details.