Skip to content

Commit

Permalink
switch composer to interfaces v2 and commons v3
Browse files Browse the repository at this point in the history
Updated readme to interfaces v2.
Removed sudo from travis config and added os linux.
  • Loading branch information
gregor-j committed Feb 3, 2020
1 parent d99cd8a commit cda56fe
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: php
sudo: false
os: linux
dist: trusty
php:
- 5.5
Expand Down
46 changes: 32 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,42 @@ This repository implements the [PHP/SAP][phpsap] interface for [Piers Hardings `
## Usage

```sh
composer require php-sap/saprfc-harding:^2.0
composer require php-sap/saprfc-harding
```

```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')
->setParam('INPUT_PARAM', 'some input value')
->invoke();
//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 @@ -23,7 +23,7 @@
"harding"
],
"provide": {
"php-sap/interfaces": "v2.x-dev"
"php-sap/interfaces": "^2.0"
},
"conflict": {
"php-sap/saprfc-koucky": "*",
Expand All @@ -32,15 +32,15 @@
},
"minimum-stability": "stable",
"require": {
"php": "~5.5.0",
"php": "^5.5",
"ext-sapnwrfc": "*",
"php-sap/interfaces": "v2.x-dev",
"php-sap/common": "v3.x-dev"
"php-sap/interfaces": "^2.0",
"php-sap/common": "^3.0"
},
"require-dev": {
"ext-json": "*",
"phpunit/phpunit": "^4.8",
"php-sap/integration-tests": "dev-php5-v3"
"php-sap/integration-tests": "^3.0"
},
"autoload": {
"psr-4": {
Expand Down
149 changes: 72 additions & 77 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cda56fe

Please sign in to comment.