PHPackages                             rapkis/laravel-controld - 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. rapkis/laravel-controld

ActiveLibrary[API Development](/categories/api)

rapkis/laravel-controld
=======================

Access the ControlD API in your Laravel application

v2.0.0(1y ago)12.7k[1 PRs](https://github.com/rapkis/laravel-controld/pulls)MITPHPPHP ^8.2CI passing

Since Oct 5Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/rapkis/laravel-controld)[ Packagist](https://packagist.org/packages/rapkis/laravel-controld)[ Docs](https://github.com/rapkis/laravel-controld)[ RSS](/packages/rapkis-laravel-controld/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (13)Versions (8)Used By (0)

Access the ControlD API in your Laravel application
===================================================

[](#access-the-controld-api-in-your-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fd2af9de23872c88165a5751fdad53d94d96da469ba5cae236a4acc1b88f2d5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261706b69732f6c61726176656c2d636f6e74726f6c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rapkis/laravel-controld)[![GitHub Tests Action Status](https://camo.githubusercontent.com/7e7166af34eddd50938af8c75a617d136f33c50748d78e7eda892093da49df84/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7261706b69732f6c61726176656c2d636f6e74726f6c642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/rapkis/laravel-controld/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1117736165cec6819af081407b655766b55dbaf313743c5ef3761f6e59ae74fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7261706b69732f6c61726176656c2d636f6e74726f6c642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/rapkis/laravel-controld/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/fc6e4b9e81a1cbc6d65856bbf302a5354f9c75b49a2809f388480fdfdf5669c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261706b69732f6c61726176656c2d636f6e74726f6c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rapkis/laravel-controld)

Access the ControlD API in your Laravel application.

This is **not** an official package and is purely a third-party API client. Any service-related issues should be directed towards the service provider itself.

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

[](#installation)

You can install the package via composer:

```
composer require rapkis/laravel-controld
```

You should publish the config file with:

```
php artisan vendor:publish --tag="laravel-controld-config"
```

This is the contents of the published config file:

```
return [
    'url' => env('CONTROL_D_API_URL'),
    'secret' => env('CONTROL_D_API_SECRET'),
    'middleware' => [
        'request' => [],
        'response' => [ControlDErrorHandlerMiddleware::class],
    ],
];
```

Make sure to define the ControlD endpoint and your API token in the .env file. You can also set up middleware classes that will be applied to your HTTP requests and responses (see [Middleware](#middleware)).

Usage
-----

[](#usage)

To access the ControlD API you first need to have an account created. Visit [controld.com](https://controld.com/). Make sure you're familiar with their [documentation](https://docs.controld.com/) and [API reference](https://docs.controld.com/reference). The package assumes you understand with how the service and the API work.

Quick Start
-----------

[](#quick-start)

The main class you'll be working with is `\Rapkis\Controld\ControlD`. You can access all ControlD endpoints by using its methods. Endpoints are organized according to the documentation for ease of use.

Start by instantiating it:

```
$controlD = app(\Rapkis\Controld\ControlD::class); // or use DI
```

`\Rapkis\Controld\ControlD` depends on Laravel's HTTP client, which is configured automatically via `\Rapkis\Controld\ControlDFactory`. To make things simple, it is recommended to resolve it via Laravel's [Service Container](https://laravel.com/docs/10.x/container) (a.k.a. `app()`, Dependency Injection, etc.) to instantiate the `\Rapkis\Controld\ControlD` class. It's already pre-configured in `\Rapkis\Controld\ControldServiceProvider`.

Now, you can make API requests

```
// Lists all profiles of your account: https://docs.controld.com/reference/get_profiles
$controlD->profiles()->list();

// Create a new profile: https://docs.controld.com/reference/post_profiles
$profile = $controlD->profiles()->create('My Profile Name'); // returns \Rapkis\Controld\Responses\Profile

// Create a new device that uses your new profile: https://docs.controld.com/reference/post_devices
$device = $controlD->devices()->create(
    'Device Name', // the name of your device
    $profile->pk, // the profile it will use
    'router', // the icon (type) of your device. Purely visual.
); // returns \Rapkis\Controld\Responses\Device
```

General structure
-----------------

[](#general-structure)

In a nutshell, the package is made up of "Resources" and "Responses". Resource classes are used to make HTTP requests and then JSON responses are mapped to Response classes. These classes are basic DTOs (data transfer objects) which are easier to work with than basic arrays: you don't have to guess array keys and can immediately understand the response structure.

Each method in the `\Rapkis\Controld\ControlD` class corresponds to the appropriate Resource class (`\Rapkis\Controld\Resources`). Resource classes make the requests and map the responses to the response classes. Usually with the help of factory classes.

Middleware
----------

[](#middleware)

Just like with the Laravel's HTTP client (or Guzzle), you can add middlware to interact with your requests and responses. You can check how they work in the [Laravel documentation](https://laravel.com/docs/10.x/http-client#guzzle-middleware)

For example, this package handles ControlD specific errors with `\Rapkis\Controld\Middleware\ControlDErrorHandlerMiddleware`. Instead of parsing the JSON response somewhere in your code, you can parse it in the middleware class and handle your errors **before** returning a response.

Feel free to modify the middleware or add your own! For example, you can have middleware which renders error-specific exceptions instead of the generic one. Alternatively, if you're running [an organization](https://docs.controld.com/docs/organizations), you can add the impersonation header (`X-Force-Org-Id: org_id_goes_here`) directly via middleware.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Rapolas Gruzdys](https://github.com/rapkis)

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance50

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 79.5% 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 ~159 days

Total

5

Last Release

366d ago

Major Versions

v1.0.3 → v2.0.02025-07-02

PHP version history (2 changes)v1.0.0PHP ^8.1

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25427665?v=4)[Rapolas Gruzdys](/maintainers/rapkis)[@rapkis](https://github.com/rapkis)

---

Top Contributors

[![rapkis](https://avatars.githubusercontent.com/u/25427665?v=4)](https://github.com/rapkis "rapkis (35 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![LmZeD](https://avatars.githubusercontent.com/u/26856758?v=4)](https://github.com/LmZeD "LmZeD (1 commits)")

---

Tags

laravelrapkislaravel-controld

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rapkis-laravel-controld/health.svg)

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

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.3k3](/packages/defstudio-telegraph)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k91](/packages/nativephp-mobile)

PHPackages © 2026

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