PHPackages                             blabs/fidelynet-sdk-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. [API Development](/categories/api)
4. /
5. blabs/fidelynet-sdk-php

ActiveLibrary[API Development](/categories/api)

blabs/fidelynet-sdk-php
=======================

a wrapper for FidelyNET loyalty service API

v2.7.6(2mo ago)0395MITPHPPHP ^8.0CI failing

Since Jul 25Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/blabs-dev/fidelynet-sdk-php)[ Packagist](https://packagist.org/packages/blabs/fidelynet-sdk-php)[ RSS](/packages/blabs-fidelynet-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (61)Used By (0)

Fidely NET api wrapper
======================

[](#fidely-net-api-wrapper)

A PHP Wrapper for FidelyNET API.

Getting started
---------------

[](#getting-started)

This SDK lets you interact with `backoffice`, `customer` and `terminal` services. The simplest way of creating an instance of a service is using the `ServiceFactory::create()` method. It requires 2 arguments, the first one is a string containing desired service, the second is an array containing the related authentication credentials provided by Data Loyalty along with some other optional parameters.

Example of using the factory to create a `terminal` service instance:

```
use Blabs\FidelyNet\ServiceFactory;

// Creates an instance of the Terminal service.
$terminal_service = ServiceFactory::create('terminal', [
    'username' => 'wsTerminal01',
    'password' => 'password',
    'terminal' => '000001'
]);

// Uses the instance to query the service to getting info on a campaign id
/** @var \Blabs\FidelyNet\Services\TerminalService $terminal_service */
$terminal_service->getCampaign('1001');
```

Supported keys for the `ServiceFactory` parameters array
--------------------------------------------------------

[](#supported-keys-for-the-servicefactory-parameters-array)

Other than credentials, you can specify several options within the second argument of the `create()` method, many of them have already a default value, use following array keys if you need to override them.

- `username`
- `password`
- `terminal`
- `campaign_id`
- `demo_mode` (boolean)
- `session_persists` (boolean)
- `session_id_provider` (implementation of `\Blabs\FidelyNet\Contracts\SessionIdProviderContract` interface)
- `session_type` (can be `public` or `private`, available for `customer` service only)
- `http_client` (an instance of `GuzzleHttp\Client` or implementation of `GuzzleHttp\ClientInterface`)

```
use Blabs\FidelyNet\ServiceFactory;

// Creates an instance of the Customer service, using a public session and with other customized options.
$customer_service = ServiceFactory::create('customer', [
    // required keys
    'username'          => 'myCustomerUserName',
    'password'          => 'myCustomerPassword',
    'campaign_id'       => '10000',
    // optional keys
    'demo_mode'         => true,
    'session_persists'  => false,
    'session_type'      => 'public',
]);
```

### Required parameters for each service

[](#required-parameters-for-each-service)

Each service needs some specific parameters in the config array in order to be instanced.

- `BackofficeService`

    - `username`
    - `password`
- `TerminalService`

    - `username`
    - `password`
    - `terminal`
- `CustomerService`

    - `username`
    - `password`
    - `campaign_id`

Session Persistence
-------------------

[](#session-persistence)

FidelyNET APIs provides an authentication system that requires to open a session on the service before starting to make actual requests.

Usually you have to make a first request to authenticate passing your credentials, then you receive a session token that will be used to authorize all subsequent requests. The token is valid for about 15 minutes from the last request made.

The SDK implements this mechanism automatically when creating an instance of the service, and it is also possible to persist the session id through multiple requests (even in multiple instances of the same service). In case of failure of a request for an expired session, the client will automatically make a new login request, renewing the token and reiterating the failed request.

Session persistence is enabled by default when you use `ServiceFactory` class, you can override this option using `session_persists` array key in the second argument of the `create()` method. By default the SDK uses a session persistence "driver" that saves data in the temporary files system directory (typically `tmp/` on a \*nix system), however you can create your own implementation of the persistence mechanism by implementing the `\Blabs\FidelyNet\Contracts\SessionIdProviderContract` interface (i.e. using session or any other storage system).

Supported API Actions
---------------------

[](#supported-api-actions)

So far the SDK supports fewer "actions" than those available on the service, our goal is to provide a library that simplify most common operations.

Service methods reference
-------------------------

[](#service-methods-reference)

A full documentation about every method available on every service will be available ASAP

### Testing

[](#testing)

```
composer test
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance88

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 79.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 ~30 days

Recently: every ~91 days

Total

57

Last Release

60d ago

Major Versions

v0.1 → v1.0.02021-07-26

v1.0.0 → v2.0.02021-07-26

v1.x-dev → v2.0.32021-07-28

PHP version history (2 changes)v0.1PHP ^7.1||^8.0

v2.0.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/51fd98be1c1dede9cc13dbdff17b1b856dd17ee5e087b61fb74ba1656670678f?d=identicon)[blabs-dev](/maintainers/blabs-dev)

---

Top Contributors

[![salvobee](https://avatars.githubusercontent.com/u/19645064?v=4)](https://github.com/salvobee "salvobee (142 commits)")[![blabs-dev](https://avatars.githubusercontent.com/u/75724335?v=4)](https://github.com/blabs-dev "blabs-dev (37 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/blabs-fidelynet-sdk-php/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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