PHPackages                             toneflix-code/cuttly-laravel - 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. toneflix-code/cuttly-laravel

ActiveLibrary[API Development](/categories/api)

toneflix-code/cuttly-laravel
============================

A Laravel API wrapper for Cutt.ly API.

2.0.0(1y ago)730.4k—8.8%6MITPHPPHP ^8.1|^8.2|^8.3

Since May 22Pushed 1y agoCompare

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

READMEChangelog (4)Dependencies (9)Versions (6)Used By (0)

Cutt.ly Laravel
===============

[](#cuttly-laravel)

[![Run Tests](https://github.com/toneflix/cuttly-laravel/actions/workflows/run-tests.yml/badge.svg)](https://github.com/toneflix/cuttly-laravel/actions/workflows/run-tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/432b8ea4e4f709094cd0b9a4689c2d9794327b1238b11da27455217874546938/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6e65666c69782d636f64652f637574746c792d6c61726176656c2e737667)](https://packagist.org/packages/toneflix-code/cuttly-laravel)[![Total Downloads](https://camo.githubusercontent.com/0691eaf2d3766ed33754e65aed7c5f981ef0b8b1cd6d9bf2835022dcb8fec857/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6e65666c69782d636f64652f637574746c792d6c61726176656c2e737667)](https://packagist.org/packages/toneflix-code/cuttly-laravel)[![License](https://camo.githubusercontent.com/e6a419f0a3e9292817cade4a1815412d2aae5abe2963924dab0eeb2cc61ba536/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6e65666c69782d636f64652f637574746c792d6c61726176656c2e737667)](https://packagist.org/packages/toneflix-code/cuttly-laravel)[![PHP Version Require](https://camo.githubusercontent.com/f7fb5e08e5c05d639451de032ca84a3957727bfef0a362b31ddd9a4ce171788e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f746f6e65666c69782d636f64652f637574746c792d6c61726176656c2f706870)](https://packagist.org/packages/toneflix-code/cuttly-laravel)[![codecov](https://camo.githubusercontent.com/6866b76390ed1a33f2e50ab94d348b3bb6b1db0540f2577cde421f6361c70d2a/68747470733a2f2f636f6465636f762e696f2f67682f746f6e65666c69782f637574746c792d6c61726176656c2f67726170682f62616467652e7376673f746f6b656e3d324f376146756c513950)](https://codecov.io/gh/toneflix/cuttly-laravel)

Cutt.ly is a Link Management Platform with all features you need in one place. Shorten your links, track clicks, and boost your brand with our all-in-one URL Shortener. Create custom short links, generate QR codes, build link-in-bio pages, and gather feedback with surveys. Start optimizing your URLs today and see the impact!y, [Cuttly PHP](https://github.com/toneflix/cuttly-php) aims to work around the Cutt.ly API by providing a simple PHP wrapper arround it, on the other hand, this package has been curated to make installation and getting started a little easier for Laravel Artisans.

Please refere to [Cutt.ly API Documentation](https://cutt.ly/cuttly-api) for detailed api use description as this package tries to mirror the API in the best possible way.

Requirements
------------

[](#requirements)

- [PHP &gt;= 8.1](http://php.net/)
- Laravel [^9.0](https://laravel.com/docs/9.x)|[^10.0](https://laravel.com/docs/10.x)|[^11.0](https://laravel.com/docs/11.x)

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

[](#installation)

You can install the package via composer:

```
composer require toneflix-code/cuttly-laravel
```

Upgrading
---------

[](#upgrading)

If you're coming from verson 1.x, you may not be able to upgrade to 2.x as version is a complete rewrite of the package, with almost full support of entire cutt.ly API, version 1.x has been moved to the v1.x.x branch and will continue to recieve security patches and features till the end of 2025.

Package Discovery
-----------------

[](#package-discovery)

Laravel automatically discovers and publishes service providers but optionally after you have installed Laravel Fileable, open your Laravel config file if you use Laravel below 11, `config/app.php` and add the following lines.

In the $providers array add the service providers for this package.

```
ToneflixCode\Cuttly\CuttlyServiceProvider::class
```

If you use Laravel &gt;= 11, open your `bootstrap/providers.php` and the above line to the array.

```
return [
    ToneflixCode\Cuttly\CuttlyServiceProvider::class,
];
```

Initialization
--------------

[](#initialization)

To start using this library you are required to add your API keys to the .env file with these variables:

```
CUTTLY_API_KEY=your-cutt.ly-API-key
CUTTLY_TEAM_API_KEY=your-cutt.ly-API-key #[Optional] For users with team subscriptions.
```

If you wish to interact directly with the base class, you might want to take a look at

#### Initialization Errors

[](#initialization-errors)

Where an API key has not not been provided, the library will throw a `ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException` exception on any other associated action call.

Regular API Usage
-----------------

[](#regular-api-usage)

### Shorten Url

[](#shorten-url)

To shorten a URL simply call the `shorten(string)` method chained to the `regular()` method of the `Cuttly` instance passing the link you intend to shorten as the only parameter.

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://toneflix.com.ng/learning';
$data = Cuttly::regular()->shorten($link);
```

The `shorten()` method returns an instance of `ToneflixCode\CuttlyPhp\Builders\ShortenResponse` which contains all properties of the request response [returned by the API](https://cutt.ly/api-documentation/regular-api).

### Chainable parameters

[](#chainable-parameters)

We have taken our time to ensure that while using this library, you have access to every available feature provided by cuttly in the first place, here is a list of parameters you can chain as methods to further customize your request.

- `name(string)`: Your desired short link - alias - if not already taken
- `noTitle()`: Faster API response time - This parameter disables getting the page title from the source page meta tag which results in faster API response time Available for Team Enterprise plan
- `public()`: Settings public click stats for shortened link via AP
- `userDomain()`: Use the domain from the user account that is approved and has the `status: active`.

#### Example Usage

[](#example-usage)

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://toneflix.com.ng/learning';
$data = Cuttly::regular()->name('toneflix101')->shorten($link);
```

Do note that `shorten()` should only be called at the end of the chain.

### Edit Short Link

[](#edit-short-link)

The library also allows you to edit the short links you have created. To edit a link simply call the `edit(string)` method chained to the `regular()` method of the `Cuttly` instance passing the short link you intend to edit as the only parameter.

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix101';
$data = Cuttly::regular()->edit($link);
```

Of course, the example above really does nothing and will throw a `ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException`. To actually edit a link, you can chain any of the below methods to your call and voila.

- `name(string)`: New alias / name, if not already taken.
- `userDomain()`: Use the domain from the user account that is approved and has the `status: active`.
- `tag(string)`: The TAG you want to add for shortened link.
- `source(string)`: Change the source url of shortened link.
- `unique(0|1|15-1440)`: Sets a unique stat count for a short link.
- `title()`: It will change the title of url of shortened link.

#### Example Usage

[](#example-usage-1)

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix101';
$data = Cuttly::regular()->name('toneflix404')->userDomain()->unique(1)->edit($link);
```

The `edit()` method returns an instance of `ToneflixCode\CuttlyPhp\Builders\BaseResponse` which contains all properties of the request response [returned by the API](https://cutt.ly/api-documentation/regular-api).

### Link analytics

[](#link-analytics)

In order to access URL statistics call the `stats(string)` method chained to the `regular()` method of the `Cuttly` instance passing the short link you intend to get analytics of as the only parameter.

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix404';
$data = Cuttly::regular()->stats($link);
```

The `stats()` method returns an instance of `ToneflixCode\CuttlyPhp\Builders\StatsResponse` which contains all properties of the request response [returned by the API](https://cutt.ly/api-documentation/regular-api).

### Delete Short Link

[](#delete-short-link)

To delete a short link call the `delete(string)` method chained to the `regular()` method of the `Cuttly` instance passing the short link you intend to get delete as the only parameter.

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix404';
$data = Cuttly::regular()->delete($link);
```

The `delete()` method returns an instance of `ToneflixCode\CuttlyPhp\Builders\BaseResponse` which contains all properties of the request response [returned by the API](https://cutt.ly/api-documentation/regular-api).

Team API Usage
--------------

[](#team-api-usage)

The team API implements the same methods and chainable methods available to the Regular API with a few exceptions that we will point out next.

TO use the Team API, instead of calling the `regular()` method on the `Cuttly` instance, we're going to call the `team()` method, you can now chain all the method we have highlighted above to use the Team API.

### Shorten Link

[](#shorten-link)

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://toneflix.com.ng/learning';
$data = Cuttly::team()->name('toneflix301')->shorten($link);
```

### Edit Short Link

[](#edit-short-link-1)

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix301';
$data = Cuttly::team()->edit($link);
```

### Link analytics

[](#link-analytics-1)

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix301';
$data = Cuttly::team()->stats($link);
```

### Delete Short Link

[](#delete-short-link-1)

```
use ToneflixCode\Cuttly\Facades\Cuttly;

$link = 'https://cutt.ly/toneflix404';
$data = Cuttly::team()->delete($link);
```

Exceptions
----------

[](#exceptions)

### `ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException`

[](#toneflixcodecuttlyphpexceptionsinvalidapikeyexception)

The `ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException` exception is thrown whenever an API key has not been provided or an invalid API key has been provided.

### `ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException`

[](#toneflixcodecuttlyphpexceptionsfailedrequestexception)

The `ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException` exception is thrown whenever the Cuttly API returns an error.

### Exception Handling

[](#exception-handling)

When you hit an exception, you can handle it in whatever way is best for your use case.

```
use ToneflixCode\Cuttly\Facades\Cuttly;
use ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException;

try {
  $link = 'https://toneflix.com.ng/learning';
  $data = Cuttly::regular()->name('toneflix404')->shorten($link);
} catch (FailedRequestException $th) {
  echo $th->getMessage();
}
```

```
use ToneflixCode\Cuttly\Facades\Cuttly;
use ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException;
use ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException;

try {
  $link = 'https://toneflix.com.ng/learning';
  $data = Cuttly::regular()->name('toneflix404')->shorten($link);
} catch (FailedRequestException|InvalidApiKeyException $th) {
  echo $th->getMessage();
}
```

For detailed descriptino about what is obtainable from the API, please read the [Cutt.ly Documentations](https://cutt.ly/api-documentation/regular-api).

Testing
-------

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Toneflix Code](https://github.com/toneflix)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~278 days

Total

4

Last Release

622d ago

Major Versions

1.0.2 → 2.0.02024-09-03

PHP version history (3 changes)1.0.0PHP ^7.4|^8.0

1.0.2PHP ^8.0|^8.1

2.0.0PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/4638f9de973d94753ebff641af3009e1049064f9a6bd76fe87e58d0d8ddd7ca7?d=identicon)[3m1n3nc3](/maintainers/3m1n3nc3)

---

Top Contributors

[![3m1n3nc3](https://avatars.githubusercontent.com/u/52163001?v=4)](https://github.com/3m1n3nc3 "3m1n3nc3 (27 commits)")

---

Tags

apilinkslink shorteningtoneflix-codecuttlycuttly-laravelcuttly-php

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/toneflix-code-cuttly-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/toneflix-code-cuttly-laravel/health.svg)](https://phpackages.com/packages/toneflix-code-cuttly-laravel)
```

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[specialtactics/l5-api

Dependencies for the Laravel API Boilerplate package

3672.8k2](/packages/specialtactics-l5-api)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

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