Skip to content

Commit

Permalink
Merge pull request #2 from php-sap/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
gregor-j authored Feb 3, 2020
2 parents a51e8ba + 89a711c commit 74fc152
Show file tree
Hide file tree
Showing 24 changed files with 1,467 additions and 1,794 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor/
dev_rfc.trc
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: php
sudo: false
os: linux
dist: trusty
php:
- 5.5
env:
Expand Down
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,42 @@ This repository implements the [PHP/SAP][phpsap] interface for [Eduard Kouckys l
## Usage

```sh
composer require php-sap/saprfc-koucky:^1.0
composer require php-sap/saprfc-koucky
```

```php
<?php
use phpsap\saprfc\SapRfcConfigA;
use phpsap\saprfc\SapRfcConnection;

$result = (new SapRfcConnection(new SapRfcConfigA([
'ashost' => 'sap.example.com',
'sysnr' => '001',
'client' => '002',
'user' => 'username',
'passwd' => 'password'
])))
->prepareFunction('MY_COOL_SAP_REMOTE_FUNCTION')
->invoke(['INPUT_PARAM' => 'value']);
//Include the composer autoloader ...
require_once 'vendor/autoload.php';
//... and add the namespaces of the classes used.
use phpsap\classes\Config\ConfigTypeA;
use phpsap\DateTime\SapDateTime;
use phpsap\saprfc\SapRfc;
/**
* Create an instance of the SAP remote function using its
* name, input parameters, and connection configuration.
*
* The imaginary SAP remote function requires a
* date as input and will return a date as output.
*
* In this case the configuration array is defined manually.
*/
$result = (new SapRfc(
'MY_COOL_SAP_REMOTE_FUNCTION',
[
'IV_DATE' => (new DateTime('2019-12-31'))
->format(SapDateTime::SAP_DATE)
],
new ConfigTypeA([
ConfigTypeA::JSON_ASHOST => 'sap.example.com',
ConfigTypeA::JSON_SYSNR => '999',
ConfigTypeA::JSON_CLIENT => '001',
ConfigTypeA::JSON_USER => 'username',
ConfigTypeA::JSON_PASSWD => 'password'
])
))->invoke();
//The output array contains a DateTime object.
echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
```

For further documentation, please read the documentation on [PHP/SAP][phpsap]!
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@
"koucky"
],
"provide": {
"php-sap/interfaces": "~1.0.0"
"php-sap/interfaces": "^2.0"
},
"conflict": {
"php-sap/saprfc-harding": "*",
"php-sap/saprfc-kralik": "*"
},
"minimum-stability": "stable",
"require": {
"php": "~5.5.0",
"php": "^5.5",
"ext-saprfc": "*",
"php-sap/interfaces": "^1.0",
"php-sap/common": "^2.0"
"php-sap/interfaces": "^2.0",
"php-sap/common": "^3.0"
},
"require-dev": {
"ext-json": "*",
"phpunit/phpunit": "^4.8",
"php-sap/integration-tests": "^1.0"
"php-sap/integration-tests": "^3.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 74fc152

Please sign in to comment.