PHPackages                             salesmachine-io/salesmachine-php - 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. salesmachine-io/salesmachine-php

ActiveLibrary

salesmachine-io/salesmachine-php
================================

The Salesmachine.io PHP library

1.0.1(10y ago)0174.5k—3.4%6MITPHPPHP &gt;=5.3.3

Since Sep 3Pushed 10y ago5 watchersCompare

[ Source](https://github.com/salesmachine-io/salesmachine-php)[ Packagist](https://packagist.org/packages/salesmachine-io/salesmachine-php)[ Docs](https://salesmachine.io/libraries/php)[ RSS](/packages/salesmachine-io-salesmachine-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

SalesMachine.IO PHP Client Library
==================================

[](#salesmachineio-php-client-library)

salesmachine-php is a library which allows you to easily send data from your PHP aplication to **SalesMachine.IO**. The library can be used right away without a complicated setup as shown in the examples below.

When using this library in a high traffic production environment you can use different options to optimize the behavior. See the chapter *Usage in Production Environments* and *Options* for more details.

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

[](#requirements)

First off, you need to have an account at SalesMachine.IO and be in possession of valid API credentials. The requirements regarding your PHP environment are quite basic:

- PHP 5.x
- CURL module
- JSON module

Quick Guide and Code Examples
-----------------------------

[](#quick-guide-and-code-examples)

### Installation

[](#installation)

The salesmachine-php client library comes as a [Composer package](https://getcomposer.org/).

### Init Salesmachine

[](#init-salesmachine)

```
Salesmachine::init($api_key, $api_secret, array('use_buffer' => true));

```

### Create or Update a Contact

[](#create-or-update-a-contact)

```
Salesmachine::set_contact($contact_uid, array('name' => 'John Doe', 'email' => 'john@doe.com'));

```

### Track Pageview of a Contact

[](#track-pageview-of-a-contact)

```
Salesmachine::track_pageview($contact_uid, array('/dashboard'));

```

### Track Events of a Contact

[](#track-events-of-a-contact)

```
Salesmachine::track_event($contact_uid, 'your event name');

```

Using salesmachine-php in Production Environments
-------------------------------------------------

[](#using-salesmachine-php-in-production-environments)

While the default settings get you going right away, it is recommended to change some settings for production environments.

By default, all requests to SalesMachine.IO are with CURL in real time. On a high traffic environment this can eventually lead to reduced performance on the host site. It is therefore recommended to enable the option "use\_buffer" which will buffer all requests to a local file first.

The local buffer can then be sent with a cron job in regular intervals by using the code below. This method ensures that the SalesMachine.IO library won't degrade the performance of the host environment.

### Store a requests in local buffer

[](#store-a-requests-in-local-buffer)

```
Salesmachine::init($api_key, $api_secret, array('use_buffer' => true));
Salesmachine::set_contact($contact_uid, array('name' => 'John Doe', 'email' => 'john@doe.com'));
...

```

### Process local buffer in cron job

[](#process-local-buffer-in-cron-job)

```
Salesmachine::init($api_key, $api_secret);
Salesmachine::flush();

```

Options
-------

[](#options)

When calling Salesmachine::init($api\_key, $api\_secret) an array of options can be passed as a third parameter. If this parameter is not present or option keys are missing, the default values are taken.

OptionDefaultDescriptionuse\_httpstrueWhether or not to send the data to SalesMachine SSL encrypteduse\_buffertrueIf set to false, requests will be sent one by one instead of batch. This is not recommended since it will add load to Salesmachine.io servers.debugfalseIf activated, debug information will be written to the log file in test/analytics-xx.logAdditional Information
----------------------

[](#additional-information)

For more information please visit

-
-

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~154 days

Total

2

Last Release

3756d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91cc2d62c98ba49a242e1bbd207154c0a8518ab231c817d82c7eb3cbfc0b5336?d=identicon)[salesmachine](/maintainers/salesmachine)

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

---

Top Contributors

[![yields](https://avatars.githubusercontent.com/u/1661587?v=4)](https://github.com/yields "yields (31 commits)")[![chezmo](https://avatars.githubusercontent.com/u/1691948?v=4)](https://github.com/chezmo "chezmo (13 commits)")[![calvinfo](https://avatars.githubusercontent.com/u/487539?v=4)](https://github.com/calvinfo "calvinfo (8 commits)")[![jdoucy](https://avatars.githubusercontent.com/u/9808257?v=4)](https://github.com/jdoucy "jdoucy (5 commits)")[![Cethy](https://avatars.githubusercontent.com/u/735030?v=4)](https://github.com/Cethy "Cethy (3 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (2 commits)")[![ianstormtaylor](https://avatars.githubusercontent.com/u/311752?v=4)](https://github.com/ianstormtaylor "ianstormtaylor (1 commits)")[![j0ew00ds](https://avatars.githubusercontent.com/u/530956?v=4)](https://github.com/j0ew00ds "j0ew00ds (1 commits)")[![AlexLombry](https://avatars.githubusercontent.com/u/1451210?v=4)](https://github.com/AlexLombry "AlexLombry (1 commits)")[![jimrubenstein](https://avatars.githubusercontent.com/u/187023?v=4)](https://github.com/jimrubenstein "jimrubenstein (1 commits)")[![loris](https://avatars.githubusercontent.com/u/8362?v=4)](https://github.com/loris "loris (1 commits)")[![marshally](https://avatars.githubusercontent.com/u/132798?v=4)](https://github.com/marshally "marshally (1 commits)")[![reinpk](https://avatars.githubusercontent.com/u/658545?v=4)](https://github.com/reinpk "reinpk (1 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (1 commits)")[![asm89](https://avatars.githubusercontent.com/u/657357?v=4)](https://github.com/asm89 "asm89 (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

---

Tags

analyticssalesmachinesalesmachine-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/salesmachine-io-salesmachine-php/health.svg)

```
[![Health](https://phpackages.com/badges/salesmachine-io-salesmachine-php/health.svg)](https://phpackages.com/packages/salesmachine-io-salesmachine-php)
```

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[segmentio/analytics-php

Segment Analytics PHP Library

25621.5M25](/packages/segmentio-analytics-php)[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.3M6](/packages/algolia-scout-extended)[irazasyed/laravel-gamp

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

3361.6M1](/packages/irazasyed-laravel-gamp)[matomo/matomo-php-tracker

PHP Client for Matomo Analytics Tracking API

2213.1M16](/packages/matomo-matomo-php-tracker)

PHPackages © 2026

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