PHPackages                             smarkio/smarkio-supplier-api-client - 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. smarkio/smarkio-supplier-api-client

ActiveLibrary

smarkio/smarkio-supplier-api-client
===================================

Accelerator to communicate with the Smarkio Supplier API

1.7.2(7y ago)112.5k↓50%2MITPHP

Since Oct 8Pushed 7y ago26 watchersCompare

[ Source](https://github.com/smarkio/smarkio-supplier-api-client)[ Packagist](https://packagist.org/packages/smarkio/smarkio-supplier-api-client)[ Docs](https://github.com/smarkio/smarkio-supplier-api-client)[ RSS](/packages/smarkio-smarkio-supplier-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (13)Used By (0)

\#Smarkio Supplier - API
========================

[](#smarkio-supplier---api)

An accelerator to communicate with © Smarkio API to create Leads

Installation and usage with Composer
------------------------------------

[](#installation-and-usage-with-composer)

Add the following to your composer.json file in order to fetch the latest stable version of the project:

```
{
    "require": {
        "smarkio/smarkio-supplier-api-client": "*"
    }
}
```

Then, in order to use the accelerator on your own PHP file, add the following:

```
require '[COMPOSER_VENDOR_PATH]/autoload.php';
```

Contents
--------

[](#contents)

- src/Smarkio/Supplier - Code to interact with the Smarkio Lead API.
- examples/ - Some examples on how to use this accelerator.

Before you start
----------------

[](#before-you-start)

You need to obtain one API token to use the API. This token is bound to each user of the Smarkio system details.

Usage
=====

[](#usage)

Send a Lead
-----------

[](#send-a-lead)

```
$api_token = 'YOUR API TOKEN HERE';
$external_id = '1';
$campaign_external_id = '98';
$ip_address = '74.125.224.72';
$email = 'dummy@example.net';
$domain = 'mywebsite.example.net';

// create Lead with mandatory parameters
$lead = new Lead($api_token, $external_id, $campaign_external_id, $ip_address, $email, $domain);

// send the Lead
$response = $lead->send();
```

Send a Lead with Files associated
---------------------------------

[](#send-a-lead-with-files-associated)

```
$api_token = 'YOUR API TOKEN HERE';
$external_id = '1';
$campaign_external_id = '98';
$ip_address = '74.125.224.72';
$email = 'dummy@example.net';
$domain = 'mywebsite.example.net';

// create Lead with mandatory parameters
$lead = new Lead($api_token, $external_id, $campaign_external_id, $ip_address, $email, $domain);

//Attach some files to it
$lead->setFiles([
    'photo' => "http://example.com/image.png",
    'cc' => "http://example.com/cc.png"
]);
// send the Lead
$response = $lead->send();
```

Send a Lead with additional fields
----------------------------------

[](#send-a-lead-with-additional-fields)

```
$api_token = 'YOUR API TOKEN HERE';
$external_id = '1';
$campaign_external_id = '98';
$ip_address = '74.125.224.72';
$email = 'dummy@example.net';
$domain = 'mywebsite.example.net';

// create Lead with mandatory parameters
$lead = new Lead($api_token, $external_id, $campaign_external_id, $ip_address, $email, $domain);

// set Lead's optional parameters
$lead->setFirstName('João');
$lead->setLastName('Silva');
$lead->setPayout('12.12');

// set Lead's extra information
$lead->addExtraField('profession', 'developer');
$lead->addExtraField('nationality', 'portuguese');

// send the Lead
$response = $lead->send();
```

Force new Lead creation
-----------------------

[](#force-new-lead-creation)

If you want to force the creation of a new Lead, bypassing the conditions that would update an existing one, use the method setForceNewLeadCreation():

```
$api_token = 'YOUR API TOKEN HERE';
$external_id = '1';
$campaign_external_id = '98';
$ip_address = '74.125.224.72';
$email = 'dummy@example.net';
$domain = 'mywebsite.example.net';

// create Lead with mandatory parameters
$lead = new Lead($api_token, $external_id, $campaign_external_id, $ip_address, $email, $domain);

// force new lead creation
$lead->setForceNewLeadCreation(true);

// send the Lead
$response = $lead->send();
```

Dump lead Info
--------------

[](#dump-lead-info)

If you want to receive lead info on response, use the method setDumpLeadInfo():

```
$api_token = 'YOUR API TOKEN HERE';
$external_id = '1';
$campaign_external_id = '98';
$ip_address = '74.125.224.72';
$email = 'dummy@example.net';
$domain = 'mywebsite.example.net';

// create Lead with mandatory parameters
$lead = new Lead($api_token, $external_id, $campaign_external_id, $ip_address, $email, $domain);

// dump lead info
$lead->setDumpLeadInfo();

// send the Lead
$response = $lead->send();
```

In this case, the `$response` will contain a new field called `lead_info`.

User custom API URL
-------------------

[](#user-custom-api-url)

###### European API URL (Default):

[](#european-api-url-default)

```
$response = $lead->send();
```

or

```
$response = $lead->send(Lead::API_BASE_URL_EU);
```

###### Brazilian API URL:

[](#brazilian-api-url)

```
$response = $lead->send(Lead::API_BASE_URL_BR);
```

###### Custom API URL:

[](#custom-api-url)

```
$response = $lead->send('https://api-custom-example.smark.io');
```

Response format
===============

[](#response-format)

The response is a JSON containing at least a 'code' and 'message' fields. The code 200 indicates that the lead was integrated successfully.

```
{"code":"200","message":"OK","lead_id":"85177", "smkid": "1:rLJGWJLW2mNNS2qq"}
```

Fields available
================

[](#fields-available)

The following lead fields are available:

Parameter nameMax sizePropertiesDescription / Valueslead\[external\_id\]Varchar(48)MandatoryIdentifier of the lead in the supplier systemlead\[campaign\_external\_id\]Varchar(48)MandatoryIdentifier of the campaign in the supplier system. This will then be mapped to the client campaign in LeadOffice.lead\[df\_uid\]Varchar(255)MandatoryDigital Fingerprint unique identifier.lead\[ip\_address\]Varchar(48)MandatoryIP Address of the client when registered the lead.lead\[payout\]Decimal(20)OptionalThe cost that is charged by the supplier to the client for this lead\[creation\_at\]lead\[title\]Optional-closedOne of the following:Miss , Mrs. , Mr.lead\[gender\]Optional-closedOne of the following: M, Flead\[first\_name\]Varchar(255)OptionalFirst Namelead\[last\_name\]Varchar(255)OptionalLast Namelead\[email\]Varchar(255)MandatoryE-mail addresslead\[phone\]Varchar(20)OptionalPhone Numberlead\[birth\_date\]DateOptionalDate of birth. Format:YYYY-MM-DDlead\[age\]Int (3)OptionalAge when lead was generatedlead\[address\]Varchar(255)OptionalPostal addresslead\[city\]Varchar(255)OptionalCitylead\[zip\_code\]Varchar(31)OptionalZip Codelead\[identification\_number1\]IntOptionalNumber of document to identify the Leadlead\[identification\_number2\]IntOptionalNumber of document to identify the Leadlead\[domain\]Varchar(255)OptionalWebsite domain where lead was generatedlead\[integration\_response\]Varchar(4096)OptionalThe response provided by the client when lead was integrated with client. Useful to include the rejection reason when lead was rejected.lead\[user\_agent\]Varchar(255)OptionalHTTP\_USER\_AGENT of the browser the user has used when lead was capturedlead\[browser\_language\]Varchar(40)OptionalThe main/default language of the browser.Can be obtained from HTTP\_ACCEPT\_LANGUAGElead\[browser\_name\]Varchar(40)OptionalThe name of the browser.lead\[browser\_version\]Varchar(40)OptionalThe version of the browserlead\[operating\_system\]Varchar(40)Optionallead\[operating\_system\_full\_name\]Varchar(40)Optionallead\[is\_mobile\]Varchar(40)Optionallead\[device\_type\]Varchar(40)Optionallead\[source\]Varchar(40)Optionallead\[source\_reference\]Varchar(40)Optionallead\[site\_hash\]Varchar(255)Optionallead\[utm\_source\]Varchar(255)OptionalCampaign sourcelead\[utm\_campaign\]Varchar(255)OptionalCampaign namelead\[utm\_medium\]Varchar(255)OptionalCampaign mediumlead\[utm\_content\]Varchar(255)OptionalCampaign contentlead\[utm\_term\]Varchar(255)OptionalCampaign termlead\[click\_uid\]Varchar(255)OptionalClick' unique IDlead\[smkid\]Varchar(255)Optionallead\[rt\_parent\_cuid\]Varchar(255)Optionallead\[rt\_list\_id\]Varchar(255)Optionallead\[rt\_list\_name\]Varchar(255)Optionallead\[rt\_list\_external\_id\]Varchar(255)Optionallead\[smk\_category\]Varchar(255)Optionallead\[smk\_subcategory\]Varchar(255)Optionallead\[smk\_create\_new\]IntOptionalUse the value '1' to force the creation of a new leadlead\[smk\_dump\_lead\_info\]IntOptionalUse the value '1' to receive lead info on responselead\[geo\_country\]Varchar(50)OptionalCountry namelead\[geo\_country\_code\]Varchar(10)OptionalCountry Code, according to ISO 3166lead\[geo\_region\]Varchar(50)OptionalRegion namelead\[geo\_region\_code\]Varchar(10)OptionalRegion code - This should come in a format "country\_code"-"region\_code", for instance PT-13 (Porto, Portugal)lead\[geo\_city\]Varchar(50)OptionalCity namelead\[files\]\[filename\]stringOptionalValues in this field will be uploaded and attached as files related to leadExtra parameters can be sent via:

Parameter nameMax sizePropertiesDescription / Valuesextra\[field\_name\]Varchar(255)Optionalextra field and value.Processing flags (NOTE: if both lead field and flag with same name are filled, lead field will have precedence):

Parameter nameMax sizePropertiesDescription / Valuesflag\[smk\_update\_different\_campaign\]IntOptionalUse the value '1' to force the creation of a new leadflag\[smk\_create\_new\]IntOptionalUse the value '1' to force the creation of a new leadflag\[smk\_dump\_lead\_info\]IntOptionalUse the value '1' to receive lead info on response

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~132 days

Total

12

Last Release

2702d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78048ae9e61dbef99ac702acb4a6194da75c2c1b6c92fe23eea6ae3a45ec3b20?d=identicon)[developers@smark.io](/maintainers/developers@smark.io)

---

Top Contributors

[![adc-pamaral](https://avatars.githubusercontent.com/u/5681250?v=4)](https://github.com/adc-pamaral "adc-pamaral (7 commits)")[![ruicampos](https://avatars.githubusercontent.com/u/1894978?v=4)](https://github.com/ruicampos "ruicampos (7 commits)")[![marcosdd](https://avatars.githubusercontent.com/u/10602309?v=4)](https://github.com/marcosdd "marcosdd (5 commits)")[![Eliaspirante](https://avatars.githubusercontent.com/u/1383008?v=4)](https://github.com/Eliaspirante "Eliaspirante (3 commits)")[![vitor-santos](https://avatars.githubusercontent.com/u/4199680?v=4)](https://github.com/vitor-santos "vitor-santos (1 commits)")

---

Tags

leadsuppliersmarkio

### Embed Badge

![Health badge](/badges/smarkio-smarkio-supplier-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/smarkio-smarkio-supplier-api-client/health.svg)](https://phpackages.com/packages/smarkio-smarkio-supplier-api-client)
```

PHPackages © 2026

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