graze / wipotec-checkweigher-client
Wipotec checkweigher client written in PHP
Installs: 16 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 12
Forks: 0
Open Issues: 1
Requires
- php: >=5.5
- graze/telnet-client: ^2.3.0
- graze/xml-utils: ^1.1.0
Requires (Dev)
- graze/standards: ^2.0
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ^3.0
README
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.