urlhive / urlhive-laravel
Laravel SDK for URLHive API
v0.4.0-beta
2026-02-03 21:15 UTC
Requires
- php: ^8.1
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- pestphp/pest: ^2.0|^3.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0
- dev-main
- v0.4.0-beta
- v0.3.1-beta
- v0.3.0-beta
- v0.2.0-beta
- v0.1.0-beta
- dev-jules-optimize-http-client-4148340666569485703
- dev-performance-resource-instance-caching-6933536478145319187
- dev-perf-optimization-async-client-13592100711179867224
- dev-perf/optimize-url-method-4536570077259946900
- dev-perf/optimize-url-shorten-array-merge-16687053158887362380
This package is not auto-updated.
Last update: 2026-03-27 19:08:50 UTC
README
This is the official Laravel SDK for the URLHive API.
Installation
You can install the package via composer:
composer require urlhive/urlhive-laravel
Configuration
Publish the config file:
php artisan vendor:publish --tag=urlhive-config
Add your API credentials to .env:
URLHIVE_API_URL=https://api.urlhive.net URLHIVE_API_TOKEN=your-api-token
Usage
URLs
use UrlHive\Laravel\Facades\UrlHive; // List URLs $urls = UrlHive::url()->list(['page' => 1]); // Shorten a URL // custom_alias: 3-20 characters, alpha-numeric/dash $response = UrlHive::url()->shorten('https://example.com', [ 'custom_alias' => 'my-link', 'expires_at' => '2026-12-31' ]); // Get URL Details $details = UrlHive::url()->get('my-link'); // Update URL UrlHive::url()->update('my-link', ['url' => 'https://new-url.com']); // Toggle URL Status // Enables or disables the short link UrlHive::url()->toggle('my-link'); // Export URL Stats (CSV) // Returns a CSV string containing detailed click data $csv = UrlHive::url()->export('my-link'); // Delete URL UrlHive::url()->delete('my-link');
Analytics
// Get URL Stats // Includes: Timeline, Countries, Cities, Devices, Browsers, Referrers $stats = UrlHive::analytics()->stats('my-link');
Bio Pages
Manage your "Link in Bio" page.
// Get Bio Page $bio = UrlHive::bio()->show(); // Create/Update Bio Page // Themes: 'minimal', 'dark', 'colorful' UrlHive::bio()->store([ 'username' => 'john.doe', 'title' => 'John Doe', 'bio' => 'Software Engineer', 'theme' => 'dark' ]); // Add Link to Bio $link = UrlHive::bio()->addLink([ 'username' => 'john.doe', 'title' => 'My Portfolio', 'url' => 'https://john.doe/portfolio', 'icon' => 'briefcase' // Optional icon identifier ]); // Update Bio Link UrlHive::bio()->updateLink($link['id'], ['title' => 'New Portfolio Title']); // Reorder Links UrlHive::bio()->reorderLinks(['id1', 'id3', 'id2']); // Delete Bio Link UrlHive::bio()->deleteLink($link['id']);
Link Lists
Create and manage collections of links. Public lists can be viewed by anyone.
// List Link Lists $lists = UrlHive::linkLists()->list(); // Create Link List $list = UrlHive::linkLists()->create([ 'name' => 'My Tech Stack', 'is_public' => true ]); // Get Link List $details = UrlHive::linkLists()->get($list['id']); // Update Link List UrlHive::linkLists()->update($list['id'], ['name' => 'Updated Name']); // Delete Link List UrlHive::linkLists()->delete($list['id']); // Add Item $item = UrlHive::linkLists()->addItem($list['id'], [ 'title' => 'Laravel', 'url' => 'https://laravel.com', 'description' => 'The PHP Framework for Web Artisans' ]); // Update Item UrlHive::linkLists()->updateItem($item['id'], ['title' => 'Laravel Framework']); // Track Item Click UrlHive::linkLists()->trackItemClick($item['id']); // Delete Item UrlHive::linkLists()->deleteItem($item['id']);
Workspaces
Note: The Workspaces API is only available for accounts on the Enterprise plan.
// List Workspaces $workspaces = UrlHive::workspaces()->list(); // Create Workspace $workspace = UrlHive::workspaces()->create(['name' => 'My Team']); // Update Workspace UrlHive::workspaces()->update($workspace['id'], ['name' => 'My New Team Name']); // Switch Workspace // Changes the active workspace for subsequent API requests UrlHive::workspaces()->switch($workspace['id']);
Pixels
Manage tracking pixels for retargeting (Facebook, Google Analytics, etc.).
// List Pixels $pixels = UrlHive::pixels()->list(); // Create Pixel // Types: 'facebook', 'google-analytics', 'custom' $pixel = UrlHive::pixels()->create([ 'name' => 'Facebook Ads', 'type' => 'facebook', 'pixel_id' => '1234567890' ]); // Get Pixel $details = UrlHive::pixels()->get($pixel['id']); // Update Pixel UrlHive::pixels()->update($pixel['id'], ['name' => 'Updated Pixel Name']); // Delete Pixel UrlHive::pixels()->delete($pixel['id']);
Testing
composer test
License
The MIT License (MIT).