From cda56fea36d9465242c1261124518dc2617c8a52 Mon Sep 17 00:00:00 2001 From: Gregor Date: Mon, 3 Feb 2020 15:27:41 +0100 Subject: [PATCH] switch composer to interfaces v2 and commons v3 Updated readme to interfaces v2. Removed sudo from travis config and added os linux. --- .travis.yml | 2 +- README.md | 46 +++++++++++----- composer.json | 10 ++-- composer.lock | 149 ++++++++++++++++++++++++-------------------------- 4 files changed, 110 insertions(+), 97 deletions(-) diff --git a/.travis.yml b/.travis.yml index e7c299c..6400eb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: php -sudo: false +os: linux dist: trusty php: - 5.5 diff --git a/README.md b/README.md index 4f2d01d..3f70023 100644 --- a/README.md +++ b/README.md @@ -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 '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]! diff --git a/composer.json b/composer.json index 1b08612..ca8a979 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "harding" ], "provide": { - "php-sap/interfaces": "v2.x-dev" + "php-sap/interfaces": "^2.0" }, "conflict": { "php-sap/saprfc-koucky": "*", @@ -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": { diff --git a/composer.lock b/composer.lock index c270791..dc18fa0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,28 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e3b9cf64e1dd0a23be68404a3208b48d", + "content-hash": "21c4d8ae0b2c1877c4fda6fadf43ca47", "packages": [ { "name": "php-sap/common", - "version": "v3.x-dev", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/php-sap/common.git", - "reference": "8f02d67bc3d7cd65b78f92d1288faac751601e08" + "reference": "d665349aff1ebbdd4ca6e72023fcc3cf676e63e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-sap/common/zipball/8f02d67bc3d7cd65b78f92d1288faac751601e08", - "reference": "8f02d67bc3d7cd65b78f92d1288faac751601e08", + "url": "https://api.github.com/repos/php-sap/common/zipball/d665349aff1ebbdd4ca6e72023fcc3cf676e63e3", + "reference": "d665349aff1ebbdd4ca6e72023fcc3cf676e63e3", "shasum": "" }, "require": { "ext-json": "*", - "php": ">=5.5.0", + "php": "^5.5|^7.0", "php-sap/datetime": "^1.1", - "php-sap/interfaces": "v2.x-dev", - "psr/container": "^1.0" + "php-sap/interfaces": "^2.0" }, "require-dev": { "phpunit/phpunit": "^4.8" @@ -54,7 +53,7 @@ "PHPSAP", "php-sap" ], - "time": "2019-12-17T12:29:11+00:00" + "time": "2020-02-03T13:09:02+00:00" }, { "name": "php-sap/datetime", @@ -108,21 +107,21 @@ }, { "name": "php-sap/interfaces", - "version": "v2.x-dev", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/php-sap/interfaces.git", - "reference": "bc06434bfdd038264f02dacc29b924e027485995" + "reference": "11f476ce12f8fc359c148950b218d186b5c29ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-sap/interfaces/zipball/bc06434bfdd038264f02dacc29b924e027485995", - "reference": "bc06434bfdd038264f02dacc29b924e027485995", + "url": "https://api.github.com/repos/php-sap/interfaces/zipball/11f476ce12f8fc359c148950b218d186b5c29ec2", + "reference": "11f476ce12f8fc359c148950b218d186b5c29ec2", "shasum": "" }, "require": { "ext-json": "*", - "php": ">=5.5.0" + "php": "^5.5|^7.0" }, "conflict": { "kba-team/php-sap": "*" @@ -151,56 +150,7 @@ "interfaces", "php-sap" ], - "time": "2020-01-13T15:26:07+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2020-02-03T12:48:15+00:00" } ], "packages-dev": [ @@ -308,25 +258,25 @@ }, { "name": "php-sap/integration-tests", - "version": "dev-php5-v3", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/php-sap/integration-tests.git", - "reference": "c9874de263ae8e131f6cabaa5322ac2f0bea47bf" + "reference": "13ef752ddd31c150a4c6643d939329ada5301a56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-sap/integration-tests/zipball/c9874de263ae8e131f6cabaa5322ac2f0bea47bf", - "reference": "c9874de263ae8e131f6cabaa5322ac2f0bea47bf", + "url": "https://api.github.com/repos/php-sap/integration-tests/zipball/13ef752ddd31c150a4c6643d939329ada5301a56", + "reference": "13ef752ddd31c150a4c6643d939329ada5301a56", "shasum": "" }, "require": { "ext-json": "*", "kba-team/memory-container": "^1.0", "php": "^5.5", - "php-sap/common": "v3.x-dev", + "php-sap/common": "^3.0", "php-sap/datetime": "^1.1", - "php-sap/interfaces": "v2.x-dev", + "php-sap/interfaces": "^2.0", "phpunit/phpunit": "^4.8" }, "type": "library", @@ -348,7 +298,7 @@ ], "description": "PHP/SAP integration tests.", "homepage": "https://php-sap.github.io/", - "time": "2020-01-31T14:32:19+00:00" + "time": "2020-02-03T13:59:15+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -936,6 +886,55 @@ "abandoned": true, "time": "2015-10-02T06:51:40+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, { "name": "sebastian/comparator", "version": "1.2.4", @@ -1476,15 +1475,11 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "php-sap/interfaces": 20, - "php-sap/common": 20, - "php-sap/integration-tests": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~5.5.0", + "php": "^5.5", "ext-sapnwrfc": "*" }, "platform-dev": {