Skip to content

Commit 74fc152

Browse files
authored
Merge pull request #2 from php-sap/v2
V2
2 parents a51e8ba + 89a711c commit 74fc152

24 files changed

+1467
-1794
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
vendor/
2+
dev_rfc.trc

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: php
2-
sudo: false
2+
os: linux
3+
dist: trusty
34
php:
45
- 5.5
56
env:

README.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +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:^1.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-
->invoke(['INPUT_PARAM' => 'value']);
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;
3049
```
3150

3251
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": "~1.0.0"
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": "^1.0",
36-
"php-sap/common": "^2.0"
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": "^1.0"
41+
"php-sap/integration-tests": "^3.0"
4242
},
4343
"autoload": {
4444
"psr-4": {

0 commit comments

Comments
 (0)