Skip to content

Commit 89a711c

Browse files
committed
switch to interfaces v2 and commons v3
Updated README too. Removed sudo from travis config and added os linux.
1 parent c81fdc5 commit 89a711c

File tree

4 files changed

+110
-97
lines changed

4 files changed

+110
-97
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: php
2-
sudo: false
2+
os: linux
33
dist: trusty
44
php:
55
- 5.5

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,42 @@ This repository implements the [PHP/SAP][phpsap] interface for [Eduard Kouckys l
1010
## Usage
1111

1212
```sh
13-
composer require php-sap/saprfc-koucky:^2.0
13+
composer require php-sap/saprfc-koucky
1414
```
1515

1616
```php
1717
<?php
18-
use phpsap\saprfc\SapRfcConfigA;
19-
use phpsap\saprfc\SapRfcConnection;
20-
21-
$result = (new SapRfcConnection(new SapRfcConfigA([
22-
'ashost' => 'sap.example.com',
23-
'sysnr' => '001',
24-
'client' => '002',
25-
'user' => 'username',
26-
'passwd' => 'password'
27-
])))
28-
->prepareFunction('MY_COOL_SAP_REMOTE_FUNCTION')
29-
->setParam('INPUT_PARAM', 'some input value')
30-
->invoke();
18+
//Include the composer autoloader ...
19+
require_once 'vendor/autoload.php';
20+
//... and add the namespaces of the classes used.
21+
use phpsap\classes\Config\ConfigTypeA;
22+
use phpsap\DateTime\SapDateTime;
23+
use phpsap\saprfc\SapRfc;
24+
/**
25+
* Create an instance of the SAP remote function using its
26+
* name, input parameters, and connection configuration.
27+
*
28+
* The imaginary SAP remote function requires a
29+
* date as input and will return a date as output.
30+
*
31+
* In this case the configuration array is defined manually.
32+
*/
33+
$result = (new SapRfc(
34+
'MY_COOL_SAP_REMOTE_FUNCTION',
35+
[
36+
'IV_DATE' => (new DateTime('2019-12-31'))
37+
->format(SapDateTime::SAP_DATE)
38+
],
39+
new ConfigTypeA([
40+
ConfigTypeA::JSON_ASHOST => 'sap.example.com',
41+
ConfigTypeA::JSON_SYSNR => '999',
42+
ConfigTypeA::JSON_CLIENT => '001',
43+
ConfigTypeA::JSON_USER => 'username',
44+
ConfigTypeA::JSON_PASSWD => 'password'
45+
])
46+
))->invoke();
47+
//The output array contains a DateTime object.
48+
echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
3149
```
3250

3351
For further documentation, please read the documentation on [PHP/SAP][phpsap]!

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
"koucky"
2323
],
2424
"provide": {
25-
"php-sap/interfaces": "v2.x-dev"
25+
"php-sap/interfaces": "^2.0"
2626
},
2727
"conflict": {
2828
"php-sap/saprfc-harding": "*",
2929
"php-sap/saprfc-kralik": "*"
3030
},
3131
"minimum-stability": "stable",
3232
"require": {
33-
"php": "~5.5.0",
33+
"php": "^5.5",
3434
"ext-saprfc": "*",
35-
"php-sap/interfaces": "v2.x-dev",
36-
"php-sap/common": "v3.x-dev"
35+
"php-sap/interfaces": "^2.0",
36+
"php-sap/common": "^3.0"
3737
},
3838
"require-dev": {
3939
"ext-json": "*",
4040
"phpunit/phpunit": "^4.8",
41-
"php-sap/integration-tests": "dev-php5-v3"
41+
"php-sap/integration-tests": "^3.0"
4242
},
4343
"autoload": {
4444
"psr-4": {

composer.lock

Lines changed: 72 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)