Skip to content

Commit 5eb5277

Browse files
committed
update basic documentation to interfaces v2 and commons v3
1 parent de45e31 commit 5eb5277

9 files changed

+276
-477
lines changed

Diff for: common.md

-30
This file was deleted.

Diff for: index.md

+43-28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
**ATTENTION: THIS IS WORK IN PROGRESS AND NOT TO BE USED UNTIL THIS MESSAGE
2-
DISAPPEARS!**
3-
41
## About PHP/SAP
52

63
PHP/SAP defines a layer of abstraction between actual SAP remote function calls
@@ -9,11 +6,11 @@ PHP/SAP defines a layer of abstraction between actual SAP remote function calls
96

107
[![PHP/SAP](res/php-sap.svg)](res/php-sap.svg)
118

12-
The [interfaces](interfaces) define a common denominator on how to configure a
9+
The interfaces define a common denominator on how to configure a
1310
connection to SAP, prepare a SAP remote function call, and invoke a SAP remote
1411
function call.
1512

16-
The [common classes and exceptions](common) add logic that is not specific to
13+
The common classes and exceptions add logic that is not specific to
1714
the underlying PHP module.
1815

1916
The module specific implementations contain code that is specific to [the
@@ -24,38 +21,56 @@ The module specific implementations contain code that is specific to [the
2421
Especially short explanation for people in a hurry.
2522

2623
Use `composer require` to add PHP/SAP to your project. Depending on the
27-
[PHP module](php-modules) you need to require a certain PHP/SAP composer
28-
package.
24+
[PHP module](php-modules) you need to require a certain PHP/SAP package.
2925

30-
Module Author | Module | supported PHP versions | composer require
31-
------------------------ | ----------- | ---------------------- | -------------------------
32-
[Eduard Koucky][koucky] | `saprfc` | PHP 4.x - 5.5.x | `composer require php-sap/saprfc-koucky`
33-
[Piers Harding][harding] | `sapnwrfc` | PHP 5.x | `composer require php-sap/saprfc-harding`
34-
[Gregor Kralik][kralik] | `sapnwrfc` | PHP 7.x | `composer require php-sap/saprfc-kralik`
26+
`composer require php-sap/saprfc-koucky`
27+
or
28+
`composer require php-sap/saprfc-harding`
29+
or
30+
`composer require php-sap/saprfc-kralik`
3531

3632
```php
3733
<?php
38-
use phpsap\saprfc\SapRfcConfigA;
39-
use phpsap\saprfc\SapRfcConnection;
40-
41-
$result = (new SapRfcConnection(new SapRfcConfigA([
42-
'ashost' => 'sap.example.com',
43-
'sysnr' => '001',
44-
'client' => '002',
45-
'user' => 'username',
46-
'passwd' => 'password'
47-
])))
48-
->prepareFunction('MY_COOL_SAP_REMOTE_FUNCTION')
49-
->setParam('INPUT_PARAM', 'some input value')
50-
->invoke();
34+
//Include the composer autoloader ...
35+
require_once 'vendor/autoload.php';
36+
//... and add the namespaces of the classes used.
37+
use phpsap\classes\Config\ConfigTypeA;
38+
use phpsap\DateTime\SapDateTime;
39+
use phpsap\saprfc\SapRfc;
40+
/**
41+
* Create an instance of the SAP remote function using its
42+
* name, input parameters, and connection configuration.
43+
*
44+
* The imaginary SAP remote function requires a
45+
* date as input and will return a date as output.
46+
*
47+
* In this case the configuration array is defined manually.
48+
*/
49+
$result = (new SapRfc(
50+
'MY_COOL_SAP_REMOTE_FUNCTION',
51+
[
52+
'IV_DATE' => (new DateTime('2019-12-31'))
53+
->format(SapDateTime::SAP_DATE)
54+
],
55+
new ConfigTypeA([
56+
ConfigTypeA::JSON_ASHOST => 'sap.example.com',
57+
ConfigTypeA::JSON_SYSNR => '999',
58+
ConfigTypeA::JSON_CLIENT => '001',
59+
ConfigTypeA::JSON_USER => 'username',
60+
ConfigTypeA::JSON_PASSWD => 'password'
61+
])
62+
))->invoke();
63+
//The output array contains a DateTime object.
64+
echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
5165
```
52-
66+
67+
Too short? Confused? You should probably read the documentation. 😉
68+
5369
## Documentation
5470

5571
* [Usage overview](usage)
5672
- [Configure a connection](saprfc-config)
57-
- [Establish a connection](saprfc-connection)
58-
- [Invoke a function call](saprfc-function)
73+
- [Configure the SAP remote function call](saprfc-function)
5974
* [DateTime conversions for SAP](datetime)
6075

6176
[koucky]: http://saprfc.sourceforge.net/ "SAPRFC extension module for PHP"

Diff for: interfaces.md

-29
This file was deleted.

Diff for: motivation.md

-24
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,4 @@ That lead to the following requirements:
1717
3. The configuration has to be as interchangeable as possible between the PHP
1818
modules.
1919

20-
### Example: connect ➔ prepare ➔ invoke
21-
22-
```php
23-
<?php
24-
25-
use phpsap\saprfc\SapRfcConnection;
26-
use phpsap\saprfc\SapRfcConfigA;
27-
28-
//stored configuration, JSON encoded
29-
$config = '{
30-
"ashost": "sap.example.com",
31-
"sysnr": "001",
32-
"client": "01",
33-
"user": "username",
34-
"passwd": "password"
35-
}';
36-
//establish a connection using the stored configuration
37-
$connection = new SapRfcConnection(new SapRfcConfigA($config));
38-
//prepare a function call
39-
$function = $connection->prepareFunction('MY_COOL_SAP_REMOTE_FUNCTION');
40-
//call the remote function
41-
$result = $function->setParam('paramName', 'value')->invoke();
42-
```
43-
4420
[koucky]: http://saprfc.sourceforge.net/ "SAPRFC extension module for PHP"

Diff for: php-modules.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Module Author | Module | supported PHP versions | PHP/SAP compos
88
[Piers Harding][harding] | `sapnwrfc` | PHP 5.x | [![Packagist][harding-version-badge]][harding-packagist]
99
[Gregor Kralik][kralik] | `sapnwrfc` | PHP 7.x | [![Packagist][kralik-version-badge]][kralik-packagist]
1010

11+
_Please note, that none of the module authors is affiliated with PHP/SAP or involved in this project._
12+
1113
See the [status page](status) on build status, the code quality and the test coverage.
1214

1315
[koucky]: http://saprfc.sourceforge.net/ "SAPRFC extension module for PHP"

0 commit comments

Comments
 (0)