PHPackages                             j3ns3n/laravel-linkly - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. j3ns3n/laravel-linkly

ActiveLibrary[API Development](/categories/api)

j3ns3n/laravel-linkly
=====================

Linkly API classes for Laravel

2.1.0(2mo ago)01.1k↓48.3%MITPHPPHP ^8.2CI passing

Since Nov 13Pushed 2mo agoCompare

[ Source](https://github.com/j3ns3n/laravel-linkly)[ Packagist](https://packagist.org/packages/j3ns3n/laravel-linkly)[ RSS](/packages/j3ns3n-laravel-linkly/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (15)Used By (0)

Laravel Linkly
==============

[](#laravel-linkly)

A Laravel Package for the Linkly API
------------------------------------

[](#a-laravel-package-for-the-linkly-api)

[![Release Version](https://camo.githubusercontent.com/0a8bc3e293e8217cefb6ed9490919b3afcf30b2b023e0f3d38485b2bd645f61d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6a336e73336e2f6c61726176656c2d6c696e6b6c793f6c6f676f3d476974687562266c6162656c3d52656c65617365)](https://camo.githubusercontent.com/0a8bc3e293e8217cefb6ed9490919b3afcf30b2b023e0f3d38485b2bd645f61d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6a336e73336e2f6c61726176656c2d6c696e6b6c793f6c6f676f3d476974687562266c6162656c3d52656c65617365)

[![PHP Version](https://camo.githubusercontent.com/200f06d6875b10bc81848ee73b56ea52f3d509350419f49c81aa19f9960acb04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6a336e73336e2f6c61726176656c2d6c696e6b6c792f7068703f6c6f676f3d706870)](https://camo.githubusercontent.com/200f06d6875b10bc81848ee73b56ea52f3d509350419f49c81aa19f9960acb04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6a336e73336e2f6c61726176656c2d6c696e6b6c792f7068703f6c6f676f3d706870)[![Laravel Version](https://camo.githubusercontent.com/9327c0158d6bf96b196b994b874f465c3baff45d34d6d51a7ecf76f50c455973/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6a336e73336e2f6c61726176656c2d6c696e6b6c792f696c6c756d696e6174652f737570706f72743f6c6162656c3d4c61726176656c266c6f676f3d6c61726176656c)](https://camo.githubusercontent.com/9327c0158d6bf96b196b994b874f465c3baff45d34d6d51a7ecf76f50c455973/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6a336e73336e2f6c61726176656c2d6c696e6b6c792f696c6c756d696e6174652f737570706f72743f6c6162656c3d4c61726176656c266c6f676f3d6c61726176656c)

Installation
------------

[](#installation)

```
composer require j3ns3n/laravel-linkly
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=linkly-config
```

Add your Linkly API key to your `.env` file:

```
LINKLY_API_KEY=your-api-key-here
LINKLY_API_URL=https://app.linklyhq.com/api/v1/
LINKLY_WORKSPACE_ID=your-workspace-id
LINKLY_TIMEOUT=30
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use J3ns3n\LaravelLinkly\Facades\Linkly;

// Create a new short link
$link = Linkly::createLink([
    'url' => 'https://example.com/very-long-url',
    'name' => 'My Example Link',
]);

echo $link->getShortUrl();
echo $link->getId();
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use J3ns3n\LaravelLinkly\Client\LinklyClient;

class LinkController extends Controller
{
    public function __construct(protected LinklyClient $linkly)
    {
    }

    public function store(Request $request)
    {
        $link = $this->linkly->createLink([
            'url' => $request->input('url'),
            'name' => $request->input('name'),
        ]);

        return response()->json($link);
    }
}
```

### Using the LinkBuilder

[](#using-the-linkbuilder)

You can use the builder pattern for more advanced link creation:

```
use J3ns3n\LaravelLinkly\Facades\Linkly;

$link = Linkly::build('https://example.com')
    ->name('My Example Link')
    ->slug('my-slug')
    ->domain('custom.domain')
    ->cloaking()
    ->blockBots()
    ->forwardParams(false)
    ->webhook('https://webhook.site/abc')
    ->utm('newsletter', 'email', 'launch')
    ->openGraph('OG Title', 'OG Desc', 'https://img.com/og.png')
    ->expires('2025-12-31T23:59:59Z', 'https://expired.com')
    ->rules(['matches' => 'US', 'percentage' => 50, 'url' => 'https://us.com', 'what' => 'geo'])
    ->create();

// The returned $link is an instance of J3ns3n\LaravelLinkly\Resources\Link
```

### Available Methods

[](#available-methods)

```
// Create a link
$link = Linkly::createLink([
    'url' => 'https://example.com',
    'name' => 'Example',
]);

// Get a link by ID
$link = Linkly::getLink($link->getId());

// List all links
$links = Linkly::listLinks();

foreach ($links as $link) {
    echo $link->getShortUrl();
}

// Update a link
$link = Linkly::updateLink($link->getId(), [
    'name' => 'Updated Name',
]);

// Delete a link
Linkly::deleteLink($link->getId());
```

### Working with Link Resources

[](#working-with-link-resources)

```
$link = Linkly::getLink(LINK_ID);

// Access properties
echo $link->getId();
echo $link->getShortUrl();
echo $link->getOriginalUrl();

// Update the link
$link = $link->update([
    'name' => 'Updated Name',
    // ...other fields...
]);

// Delete the link
$deleted = $link->delete();

// Convert to array
$array = $link->toArray();

// Convert to JSON
$json = json_encode($link);
```

### Error Handling

[](#error-handling)

```
use J3ns3n\LaravelLinkly\Exceptions\LinklyException;

try {
    $link = Linkly::createLink([
        'url' => 'https://example.com',
    ]);
} catch (LinklyException $e) {
    Log::error('Linkly API error: ' . $e->getMessage());
    return response()->json(['error' => 'Failed to create link'], 500);
}
```

Testing
-------

[](#testing)

```
composer test
composer pint
composer stan
```

License
-------

[](#license)

MIT

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~19 days

Total

12

Last Release

74d ago

Major Versions

1.2.0 → 2.0.02025-12-19

PHP version history (2 changes)1.0.0PHP ^8.3

1.1.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23317944?v=4)[Jensen Larkin](/maintainers/j3ns3n)[@j3ns3n](https://github.com/j3ns3n)

---

Top Contributors

[![j3ns3n](https://avatars.githubusercontent.com/u/23317944?v=4)](https://github.com/j3ns3n "j3ns3n (47 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/j3ns3n-laravel-linkly/health.svg)

```
[![Health](https://phpackages.com/badges/j3ns3n-laravel-linkly/health.svg)](https://phpackages.com/packages/j3ns3n-laravel-linkly)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
