graze/wipotec-checkweigher-client

Wipotec checkweigher client written in PHP

v1.2.3 2020-12-13 19:08 UTC

This package is auto-updated.

Last update: 2024-11-14 03:37:19 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Wipotec checkweigher client written in PHP.

Install

Via Composer

$ composer require graze/wipotec-checkweigher-client

Usage

Instantiating a client

Use the factory method to return a Client instance:

$client = \Graze\WipotecCheckweigherClient\Client::factory();
...

Sending requests

Connect to the remote checkweigher using the connect method:

...
$dsn = '127.0.0.1:55001';
$client->connect($dsn);
...

Once connected, the sendRequest method can be used to send requests to the checkweigher:

...
$request = new \Graze\WipotecCheckweigherClient\Request\RequestSetArticle();
$request->setArticleParam(Parameter::NAME, $articleName);
$request->setArticleParam(Parameter::NUMBER, $articleNumber);
$response = $client->sendRequest($request);
...

Responses

If a corresponding response class exists (in \Graze\Wipotec\Response\) for a request then it will be used, otherwise the ResponseGeneric will be returned.

All responses have the following methods:

/**
 * Whether an error was returned.
 *
 * @return bool
 */
public function hasError();

/**
 * Get the error message. 
 *
 * @return string
 */
public function getError();

/**
 * Get the raw response as an array. 
 *
 * @return mixed[]
 */
public function getContents();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

make build test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@graze.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.