Download the PHP package digitsrl/php-wom-connector without Composer

On this page you can find all versions of the php package digitsrl/php-wom-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-wom-connector

PHP Connector for the WOM Platform

Setup

Installation of the PHP WOM Connector is only a Composer command away:

This will automatically install all packages required by the Connector and check compatibility with your setup.

Configuration

Check out /test/example_instrument.php, /test/example_pos.php, and /test/example_check.php files for samples of how to use the connector.

It is suggested to set the default timezone to UTC before using the Connector.

By default, the WOM Connector sets up an internal logger that writes informative messages to STDERR, but you can customize the logging handlers using the Initialize method (which takes a single handler or an array of Monolog handlers):

WOM vouchers can be generated on different domains, with different (and custom) Registry installations. By default, the Connector picks the standard Registry, which lives on the official wom.social domain. You can customize this using the following configuration line:

When developing your new WOM Platform integration, it can be useful to test on the development domain dev.wom.social (contact the WOM development team about this). The POS/Instrument keys and IDs that are used in the test scripts can be freely used on the development domain.

Voucher generation

The process of generating WOMs is pretty straightforward. You just need to be sure to comply with the requirements of the Platform and be registered as a WOM "Instrument".

The very first step is to import the connector library, including the autoload script generated by Composer.

Creating an Instrument

To generate WOMs you need to instantiate an Instrument. To do that, you will need the Id and the Private Key associated with your Instrument. Note that the second parameter contains the path to the key file (.pem).

Note: if your key is password-protected, you can optionally pass the password along with the other parameters. Otherwise, pass in NULL or an empty string.

Generating voucher specifications

To request WOMs you need to specify what kind of information you need them to contain. Since multiple vouchers can be requested at once, you need to instantiate an array of voucher specifications.

In this case, we populate the array with just one type of voucher:

In case you need many identical vouchers you can specify their quantity with the additional parameter count:

Here we are asking for 100 WOM vouchers.

Perform the request

You are almost done! You just need to actually request the vouchers. If the request is successful the server response will contain the OTC and the Password which you should present to your users in order to allow them to redeem the WOMs they earned.

The full example is in example_instrument.php.

Payment request generation

The process of generating payments for the WOM Platform is very similar to the voucher generation process: please follow the same setup and autoload steps.

Creating a Point of Service

Just like when instantiating Instruments, you can instantiate your POS by providing its Id and its Private Key:

Note: just like above, the private key parameter contains the path to the key file. Also, even if POS and Instrument belong to the same entity, they will have different IDs and keys.

Generating a payment filter

To obtain a payment request you usually only need to specify the amount of WOMs to be paid. However, you may also specify a filter that will be used to select which WOM vouchers are valid for payment and which are not.

Providing a payment filter makes you able to choose which kind of vouchers can be used to pay your services. Filters can be comprised of one or more of the following elements:

All parameters are optional:

In case you want to accept any kind of vouchers as a payment, you still need to provide an empty filter:

Generating the request

You are just a method invocation away from generating a proper payment request. Just call the RequestVouchers method as shown below:

The full example is in example_pos.php.


All versions of php-wom-connector with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
ext-openssl Version *
php Version >=7.0
guzzlehttp/guzzle Version ^6.5
ramsey/uuid Version ^3.9
monolog/monolog Version ^1.16
phpseclib/phpseclib Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package digitsrl/php-wom-connector contains the following files

Loading the files please wait ....