sharasolns / link-shortener
Link shortener for php
Installs: 2 671
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2025-02-24 08:47:12 UTC
README
Php package to easily shorten your links from https://sm.ke.
Installation
Using composer, install it with the following command
composer require sharasolns/link-shortener
Authentication
You need an api key to use this package, procedure
- Login to your sm account here https://app.sm.ke
- Go to Profile > Settings > ApiKeys or click this link if you are logged in https://app.sm.ke/settings/tab/api-keys
- Click Add Key, give it a name then submit
- You will be prompted to copy the api key You are done with generating api key, use it in the step below
Usage
To use it, in plain php, below is the code structure
$apikey = "Your_Api_ Key";
$shortener = new \Sharasolns\LinkShortener\Links\Shortener($apikey);
$longUrl = "https://example.com/long-url";
$res = $shortener->shortenLink($url);
$shortenedUrl = $res->link->shortened_url