Download the PHP package blabs/fidelynet-sdk-php without Composer
On this page you can find all versions of the php package blabs/fidelynet-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blabs/fidelynet-sdk-php
More information about blabs/fidelynet-sdk-php
Files in blabs/fidelynet-sdk-php
Package fidelynet-sdk-php
Short Description a wrapper for FidelyNET loyalty service API
License MIT
Informations about the package fidelynet-sdk-php
Fidely NET api wrapper
A PHP Wrapper for FidelyNET API.
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:
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 bepublic
orprivate
, available forcustomer
service only)http_client
(an instance ofGuzzleHttp\Client
or implementation ofGuzzleHttp\ClientInterface
)
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
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
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
A full documentation about every method available on every service will be available ASAP
Testing
All versions of fidelynet-sdk-php with dependencies
ext-curl Version *
ext-json Version *
graham-campbell/guzzle-factory Version ^3.0||^4.0||^5.0
guzzlehttp/guzzle Version ^6.2||^7.0
spatie/data-transfer-object Version ^3.3.0