PHPackages                             favoriteeats/laravel-calq-http - 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. favoriteeats/laravel-calq-http

ActiveLibrary

favoriteeats/laravel-calq-http
==============================

A Laravel wrapper for the Calq HTTP API

016PHP

Since Jul 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/FavoriteEats/laravel-calq-http)[ Packagist](https://packagist.org/packages/favoriteeats/laravel-calq-http)[ RSS](/packages/favoriteeats-laravel-calq-http/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel-Calq-HTTP
=================

[](#laravel-calq-http)

Laravel-Calq-HTTP is an API wrapper for the [Calq.io HTTP API](https://calq.io/docs/client/http). This package is useful in cases where you don't need or want client-side integration with the Calq Javascript client. Where client-side integration is desired, please consider using the official [Calq PHP client](https://calq.io/docs/client/php).

\##Prerequisites

- PHP &gt;= 5.5.9
- Laravel ~5.1
- Composer (recommended, not required)
- Calq account and application write\_key

Install
-------

[](#install)

To install Laravel Calq HTTP:

- `composer require favoriteeats/laravel-calq-http` or add `"favoriteeats/laravel-calq-http": "dev-master"` to the require section of your composer.json file
- Add `FavoriteEats\CalqHTTP\CalqHTTPServiceProvider::class` to your config/app.php "providers" array
- Then, run `composer install` or `composer update`
- Optionally, export the config file with `php artisan vendor:publish --provider=FavoriteEats\Laravel-Calq-HTTP\CalqHTTPServiceProvider` and edit config/calqhttp.php, or (better) add the expected config values to your .env file

Usage
-----

[](#usage)

See [Calq HTTP API documentation](https://calq.io/docs/client/http) for full information.

```
//First, specify the HTTP client you want to use. The service provider defaults to Guzzle,
// and Guzzle is the only client currently supported.

$calqHTTPApi = new FavoriteEats\CalqHTTP\API\GuzzleCalqHTTPAPI();

//Then, instantiate the main Calq class.
$calq = new CalqHTTP($calqHTTPApi, '[Calq write key]');

//If the CalqHTTP instance is resolved through the IoC container then the Guzzle client and write key are
// automatically composed with the object as a singleton for you

use FavoriteEats\CalqHTTP\CalqHTTP;

class SomeController extends Controller {

    protected $calq;

    public function __construct(CalcHTTP $calq)
    {
        $this->$calq = $calq;
    }

}
```

### Using the /track endpoint

[](#using-the-track-endpoint)

```
//Now create a payload corresponding to the type of request you want to make. Payloads include:
// CalqTrackPayload (/track endpoint), CalqProfilePayload (/profile endpoint),
// and CalqIdentityPayload (/transfer endpoint). An array of CalqTrackPayloads
// is used in /batch endpoint operations.

$payload = new FavoriteEats\CalqHTTP\Payloads\CalqTrackPayload([
    12345,                                             //actor (required); unique identifier for the user
    'some_action_name',                                //action_name (required); name of the action you're tracking
    [                                                  //properties (required), [] allowed; custom or special properties
        'time_on_page' => 65.2,
        '$view_url' => 'http://www.example.com/somepage',
        '$device_mobile' => true
    ],
    '192.168.10.100',                                  //ip_address (optional); actor's ip address
    Carbon::now()->tz('utc')->format('Y-m-d\TH:i:s\Z') //timestamp (optional); timestamp of event, example using Carbon
]);

$response = $calq->track($payload);

echo $response->getBody(); //response is a GuzzleHttp\Message\Response object

//Payload attributes may also be set individually.
$payload = new FavoriteEats\CalqHTTP\Payloads\CalqTrackPayload();
$payload->setActor(12345);
$payload->setActionName('some_action_name');
$payload->setProperties(['test'=>true]);
```

#### Sending a multiple payloads in one batch

[](#sending-a-multiple-payloads-in-one-batch)

```
//Send multiple payloads together as follows...

foreach($userAction as $action) {
    $payload = new FavoriteEats\CalqHTTP\Payloads\CalqTrackPayload([
        'actor' => $action->user->id,
        'action_name' => $action->name,
        'properties' => [
            '$view_url' => $visit->pageUrl
        ]
    ]);

    $calq->batch($payload);
}

$response = $calq->track() //sends all batched CalqTrackPayload payloads
```

### Using the /profile endpoint

[](#using-the-profile-endpoint)

```
$payload = new FavoriteEats\CalqHTTP\Payloads\CalqProfilePayload([
    12345,
    [
        'height' => '5ft 11in',
        'weight' => '185lbs',
        'favorite_color' => 'blue'
        '$full_name' => 'Snoopy Dawg',
        '$gender' => 'male',
        '$age' => 29
    ]
]);
$response = $calq->profile($payload);
```

### Using the /transfer endpoint

[](#using-the-transfer-endpoint)

```
$payload = new FavoriteEats\CalqHTTP\Payloads\CalqIdentityPayload([12346, 12345]);
$response = $calq->transfer($payload);
```

### Advanced

[](#advanced)

You can also verify that a payload has all required fields set before sending it to the API using the `$payload->verify()` method.

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

[](#contributing)

Please report any issues on the issues page. Pull requests are welcome.

License
-------

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0c70918db04d1ba8f8a10ad33b3d6692eab17a865d6a861287f5d3a0063f539?d=identicon)[favoriteeats](/maintainers/favoriteeats)

---

Top Contributors

[![fe-slewis](https://avatars.githubusercontent.com/u/12700804?v=4)](https://github.com/fe-slewis "fe-slewis (12 commits)")

### Embed Badge

![Health badge](/badges/favoriteeats-laravel-calq-http/health.svg)

```
[![Health](https://phpackages.com/badges/favoriteeats-laravel-calq-http/health.svg)](https://phpackages.com/packages/favoriteeats-laravel-calq-http)
```

PHPackages © 2026

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