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

ActiveLibrary

webmarketer/webmarketer-php
===========================

The official PHP SDK for Webmarketer (app.webmarketer.io)

3.6.0(1y ago)55631MITPHPPHP ^5.5 || ^7.0 || ^8.0CI passing

Since Sep 1Pushed 1y agoCompare

[ Source](https://github.com/webmarketer-saas/php-webmarketer-sdk)[ Packagist](https://packagist.org/packages/webmarketer/webmarketer-php)[ Docs](https://github.com/webmarketer-saas/php-webmarketer-sdk)[ RSS](/packages/webmarketer-webmarketer-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (10)Versions (39)Used By (1)

 [ ![](https://avatars.githubusercontent.com/u/89253090?s=200&v=4) ](https://webmarketer.io)

PHP SDK for Webmarketer
=======================

[](#php-sdk-for-webmarketer)

[![Latest Stable Version](https://camo.githubusercontent.com/bfeecca0612ef4bc50f3b1fae34a0ff85658b90c8467b1debcd1de51db982d0f/687474703a2f2f706f7365722e707567782e6f72672f7765626d61726b657465722f7765626d61726b657465722d7068702f76)](https://packagist.org/packages/webmarketer/webmarketer-php)[![Total Downloads](https://camo.githubusercontent.com/10c23181b6ad3b844bab27fcdfc6dc2e24d10323ecc99acd82ea3f9e0da40b58/687474703a2f2f706f7365722e707567782e6f72672f7765626d61726b657465722f7765626d61726b657465722d7068702f646f776e6c6f616473)](https://packagist.org/packages/webmarketer/webmarketer-php)[![Latest Unstable Version](https://camo.githubusercontent.com/b6febe706894819a7763261734203c56cb32a4023475c2ea039f47133a9ea410/687474703a2f2f706f7365722e707567782e6f72672f7765626d61726b657465722f7765626d61726b657465722d7068702f762f756e737461626c65)](https://packagist.org/packages/webmarketer/webmarketer-php)[![PHP Version Require](https://camo.githubusercontent.com/0c553082409fbb7ef3c39074a23c5c2747f203e837e0bde16446d584bbb0e888/687474703a2f2f706f7365722e707567782e6f72672f7765626d61726b657465722f7765626d61726b657465722d7068702f726571756972652f706870)](https://packagist.org/packages/webmarketer/webmarketer-php)[![License](https://camo.githubusercontent.com/98ab541c1ce27eca4e7ab1cfc77767e1af43830237937e294a8e8f8f9e19dc33/687474703a2f2f706f7365722e707567782e6f72672f7765626d61726b657465722f7765626d61726b657465722d7068702f6c6963656e7365)](https://packagist.org/packages/webmarketer/webmarketer-php)

The official PHP SDK for Webmarketer (app.webmarketer.io).

Install
-------

[](#install)

To add this package, your project must meet several requirements :

- PHP &gt;= 5.6
- Composer ([install composer](https://getcomposer.org))
- OpenSSL extension for PHP

This package is the **core** SDK and is **not** installed with any specific HTTP library. It uses **PSR-7 implementation** [Httplug](https://github.com/php-http/httplug) to be used with any PSR-7 compliant client. If you don't know which to use, we recommend using [Guzzle](https://github.com/guzzle/guzzle) (you just need to require it in your project).

```
composer require webmarketer/webmarketer-php
```

Usage
-----

[](#usage)

### Basic example

[](#basic-example)

```
try {
    // create an instance of the SDK with the desired configuration
    $client = new \Webmarketer\WebmarketerSdk([
        'default_project_id' => 'webmarketer-awesome-project'
    ]);
} catch (\Webmarketer\Exception\DependencyException $dep_ex) {
    // SDK init throw a dependency exception if requirements are not meet (see Install)
} catch (\Webmarketer\Exception\CredentialException $cred_ex) {
    // SDK automatically try to authenticate you agains API
    // A credential exception could be throw if credentials are invalid
}

// SDK exposes resources services, use them to manipulate your resources
$event_type_service = $client->getEventTypeService();
$field_service = $client->getFieldService();
```

### Authentication

[](#authentication)

The SDK exposes auth providers to let you chose how you want to authenticate against the Webmarketer API

#### Service Account Provider

[](#service-account-provider)

This is the default authentication method used by the SDK if no provider is specified manually.
Without **any configuration** the SDK will try to retrieve a service-account file in the location specified by the environment variable named `WEBMARKETER_APPLICATION_CREDENTIALS`.

**Example :**

- My Webmarketer Service Account is located at the following path on my server : `/secrets/webmarketer/sa.json`
- I set the env. variable on my server with the path : `WEBMARKETER_APPLICATION_CREDENTIALS=/secrets/webmarketer/sa.json`
- I do not need to specify an auth provider as the SDK will automatically authenticate with my Service Account

It is possible to specify the stringified JSON sa aswell by simply passing the `ServiceAccountAuthProvider` manually to the SDK :

```
try {
    $sa_auth_provider = new \Webmarketer\Auth\ServiceAccountAuthProvider([
       // stringified service account
       'credential' => '{ ...serviceAccount }',
       // desired scopes, space separated
       'scopes' => 'full_access'
    ]);
    // create an instance of the SDK with the custom auth provider
    $client = new \Webmarketer\WebmarketerSdk(
        [
            'default_project_id' => 'webmarketer-awesome-project'
        ],
        $sa_auth_provider
    );
} catch (\Webmarketer\Exception\DependencyException $dep_ex) {
    // SDK init throw a dependency exception if requirements are not meet (see Install)
} catch (\Webmarketer\Exception\CredentialException $cred_ex) {
    // SDK automatically try to authenticate you agains API
    // A credential exception could be throw if credentials are invalid
}
```

#### Refresh Token Provider

[](#refresh-token-provider)

The refresh token auth provider lets you authenticate against the API with a personal refresh token. You just need to instantiate the Webmarketer SDK with the `RefreshTokenAuthProvider` :

```
try {
    $refresh_token_auth_provider = new \Webmarketer\Auth\RefreshTokenAuthProvider([
       // oauth application client_id
       'client_id' => 'appclientid',
       // oauth application client_secret
       'client_secret' => 'appclientsecret',
       // refresh token
       'refresh_token' => 'myrefreshtoken'
    ]);
    // create an instance of the SDK with the custom auth provider (this time the refresh_token_auth_provider)
    $client = new \Webmarketer\WebmarketerSdk(
        [
            'default_project_id' => 'webmarketer-awesome-project'
        ],
        $refresh_token_auth_provider
    );
    // perform an exchange of the refresh flow to get an access token as well as a new refresh token
    $response = $client->getAuthProvider()->refreshToken();
    // new refresh token can be securely stored for future use
    $new_refresh_token = $response['refresh_token'];
} catch (\Webmarketer\Exception\DependencyException $dep_ex) {
    // SDK init throw a dependency exception if requirements are not meet (see Install)
} catch (\Webmarketer\Exception\CredentialException $cred_ex) {
    // SDK automatically try to authenticate you agains API
    // A credential exception could be throw if credentials are invalid
}
```

### Official integrations

[](#official-integrations)

Following integrations are developed and maintained by the Webmarketer Team and are based on this SDK.

- [WordPress Plugin](https://github.com/webmarketer-saas/wp-webmarketer)
- [Prestashop Module](https://github.com/webmarketer-saas/prestashop-webmarketer)

Resources
---------

[](#resources)

- [App](https://app.webmarketer.io)
- [Official documentation](https://doc.webmarketer.io)
- [Official site](https://webmarketer.io)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance43

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~36 days

Recently: every ~89 days

Total

36

Last Release

453d ago

Major Versions

0.1.0 → 1.0.02021-09-08

1.2.2 → 2.0.0.x-dev2023-09-28

2.1.0.x-dev → 3.0.0.x-dev2023-09-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/736e87546d80a72fb9331f92595e613d695295da480d8ff0646eaa41e07d5248?d=identicon)[clement-clx](/maintainers/clement-clx)

---

Top Contributors

[![clement-clx](https://avatars.githubusercontent.com/u/89252931?v=4)](https://github.com/clement-clx "clement-clx (20 commits)")[![Melvin-YABAWT](https://avatars.githubusercontent.com/u/89252914?v=4)](https://github.com/Melvin-YABAWT "Melvin-YABAWT (3 commits)")[![martnii](https://avatars.githubusercontent.com/u/181076660?v=4)](https://github.com/martnii "martnii (1 commits)")

---

Tags

sdkwebmarketerapp.webmarketer.io

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[mailgun/mailgun-php

The Mailgun SDK provides methods for all API functions.

1.1k28.9M168](/packages/mailgun-mailgun-php)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[jolicode/slack-php-api

An up to date PHP client for Slack's API

2534.4M12](/packages/jolicode-slack-php-api)[j0k3r/graby

Graby helps you extract article content from web pages

384349.6k2](/packages/j0k3r-graby)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)

PHPackages © 2026

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