-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#major - Refactor namespace to new vendor name. Initial version 0.1.0
- Loading branch information
Showing
114 changed files
with
660 additions
and
562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
{ | ||
"name": "loeffelhardt/el-cxml", | ||
"name": "friendsofcxml/cxml-php", | ||
"license": "MIT", | ||
"description": "PHP Implementation of cXML", | ||
"description": "PHP Implementation of cXML Standard", | ||
"keywords": [ | ||
"data", | ||
"xml", | ||
"cxml", | ||
"edi", | ||
"commerce", | ||
"e-commerce" | ||
"e-commerce", | ||
"punchout", | ||
"order-request" | ||
], | ||
"type": "library", | ||
"authors": [ | ||
|
@@ -17,7 +19,8 @@ | |
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Giovanni Piemontese" | ||
"name": "Giovanni Piemontese", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
|
@@ -40,7 +43,12 @@ | |
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Mathielen\\CXml\\": "src/Mathielen/CXml/" | ||
"CXml\\": "src/CXml/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"CXmlTest\\": "tests/CXmlTest/" | ||
} | ||
}, | ||
"scripts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
This repository is a public fork of https://github.com/mathielen/cxml implementation. | ||
|
||
# What is it? | ||
|
||
> cXML is a streamlined protocol intended for consistent communication of business documents between procurement | ||
|
@@ -19,7 +17,7 @@ This repository is a public fork of https://github.com/mathielen/cxml implementa | |
## Installation | ||
|
||
```bash | ||
$ composer require loeffelhardt/el-cxml | ||
$ composer require friendsofcsml/cxml-php | ||
``` | ||
|
||
Then include Composer’s autoloader: | ||
|
@@ -40,25 +38,25 @@ require_once 'vendor/autoload.php'; | |
|
||
```php | ||
//we use a basic registry here. You could use your own (db-based?) repository that implements CredentialRepositoryInterface | ||
$credentialRegistry = new \Mathielen\CXml\Credential\CredentialRegistry(); | ||
$credentialRegistry = new \CXml\Credential\CredentialRegistry(); | ||
|
||
$someSupplier = new \Mathielen\CXml\Model\Credential('DUNS', 12345); | ||
$someSupplier = new \CXml\Model\Credential('DUNS', 12345); | ||
$credentialRegistry->registerCredential($someSupplier); | ||
|
||
$someBuyer = new \Mathielen\CXml\Model\Credential('my-id-type', "[email protected]"); | ||
$someBuyer = new \CXml\Model\Credential('my-id-type', "[email protected]"); | ||
$credentialRegistry->registerCredential($someBuyer); | ||
|
||
$someHub = new \Mathielen\CXml\Model\Credential('my-id-type', "[email protected]", "abracadabra"); | ||
$someHub = new \CXml\Model\Credential('my-id-type', "[email protected]", "abracadabra"); | ||
$credentialRegistry->registerCredential($someHub); | ||
``` | ||
|
||
### Register Handler | ||
|
||
```php | ||
$handlerRegistry = new \Mathielen\CXml\Handler\HandlerRegistry(); | ||
$handlerRegistry = new \CXml\Handler\HandlerRegistry(); | ||
|
||
$handlerRegistry->register(new Mathielen\CXml\Handler\Request\SelfAwareProfileRequestHandler(...)); | ||
$handlerRegistry->register(new Mathielen\CXml\Handler\Request\StaticStartPagePunchOutSetupRequestHandler(...)); | ||
$handlerRegistry->register(new CXml\Handler\Request\SelfAwareProfileRequestHandler(...)); | ||
$handlerRegistry->register(new CXml\Handler\Request\StaticStartPagePunchOutSetupRequestHandler(...)); | ||
$handlerRegistry->register(new MyOrderRequestHandler()); | ||
$handlerRegistry->register(new MyStatusUpdateRequestHandler()); | ||
... | ||
|
@@ -67,18 +65,18 @@ $handlerRegistry->register(new MyStatusUpdateRequestHandler()); | |
### Build cXML | ||
|
||
```php | ||
//$payload = new \Mathielen\CXml\Model\Message\...Message(...); | ||
//$payload = new \CXml\Model\Message\...Message(...); | ||
//or... | ||
//$payload = new \Mathielen\CXml\Model\Request\...Request(...); | ||
//$payload = new \CXml\Model\Request\...Request(...); | ||
//or... | ||
$payload = new \Mathielen\CXml\Model\Response\...Response(...); | ||
$payload = new \CXml\Model\Response\...Response(...); | ||
|
||
$cXml = \Mathielen\CXml\Builder::create() | ||
$cXml = \CXml\Builder::create() | ||
->payload($payload) | ||
->build(); | ||
|
||
$payload = new \Mathielen\CXml\Model\Request\...Request(...); | ||
$cXml = \Mathielen\CXml\Builder::create() | ||
$payload = new \CXml\Model\Request\...Request(...); | ||
$cXml = \CXml\Builder::create() | ||
->payload($payload) | ||
->from(...) | ||
->to(...) | ||
|
@@ -91,17 +89,17 @@ $cXml = \Mathielen\CXml\Builder::create() | |
You may want to register sent-out documents so they can be referenced by subsequent request-documents via payloadId. | ||
|
||
```php | ||
$documentRegistory = new MyDocumentRegistry(); //implements Mathielen\CXml\Document\DocumentRegistryInterface | ||
$documentRegistory = new MyDocumentRegistry(); //implements CXml\Document\DocumentRegistryInterface | ||
|
||
$documentRegistory->register($cXml); | ||
``` | ||
|
||
### Process incoming cXML documents | ||
|
||
```php | ||
$headerProcessor = new \Mathielen\CXml\Processor\HeaderProcessor($credentialRegistry); | ||
$headerProcessor = new \CXml\Processor\HeaderProcessor($credentialRegistry); | ||
|
||
$cXmlProcessor = new \Mathielen\CXml\Processor\Processor( | ||
$cXmlProcessor = new \CXml\Processor\Processor( | ||
$headerProcessor, | ||
$handlerRegistry, | ||
$builder | ||
|
@@ -113,25 +111,25 @@ $cXmlProcessor->process($cXml); | |
### Putting it all together | ||
|
||
```php | ||
$credentialRegistry = new \Mathielen\CXml\Credential\CredentialRegistry(); | ||
$credentialRegistry = new \CXml\Credential\CredentialRegistry(); | ||
//TODO register... | ||
|
||
$handlerRegistry = new \Mathielen\CXml\Handler\HandlerRegistry(); | ||
$handlerRegistry = new \CXml\Handler\HandlerRegistry(); | ||
//TODO register... | ||
|
||
$builder = \Mathielen\CXml\Builder::create(); | ||
$builder = \CXml\Builder::create(); | ||
|
||
$headerProcessor = new \Mathielen\CXml\Processor\HeaderProcessor($credentialRegistry); | ||
$cXmlProcessor = new \Mathielen\CXml\Processor\Processor( | ||
$headerProcessor = new \CXml\Processor\HeaderProcessor($credentialRegistry); | ||
$cXmlProcessor = new \CXml\Processor\Processor( | ||
$headerProcessor, | ||
$handlerRegistry, | ||
$builder | ||
); | ||
|
||
$pathToDtd = '.'; //point the directory with extracted contents of zip-file with the DTDs, downloaded from cxml.org | ||
$dtdValidator = new \Mathielen\CXml\Validation\DtdValidator($pathToDtd); | ||
$dtdValidator = new \CXml\Validation\DtdValidator($pathToDtd); | ||
|
||
$endpoint = new \Mathielen\CXml\Endpoint( | ||
$endpoint = new \CXml\Endpoint( | ||
$dtdValidator, | ||
$cXmlProcessor | ||
); | ||
|
@@ -143,3 +141,5 @@ $result = $endpoint->parseAndProcessStringAsCXml($xmlString); | |
//$result could be null (i.e. for a Response or Message) or another CXml object which would be the Response to a Request | ||
//you would have to handle the transport yourself | ||
``` | ||
# Credits | ||
- Markus Thielen (https://github.com/mathielen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 19 additions & 19 deletions
38
...elen/CXml/Builder/OrderRequestBuilder.php → src/CXml/Builder/OrderRequestBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
...Builder/ProductActivityMessageBuilder.php → ...Builder/ProductActivityMessageBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
...l/Builder/PunchoutOrderMessageBuilder.php → ...l/Builder/PunchoutOrderMessageBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...tial/CredentialAuthenticatorInterface.php → ...tial/CredentialAuthenticatorInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...en/CXml/Credential/CredentialRegistry.php → src/CXml/Credential/CredentialRegistry.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...dential/CredentialRepositoryInterface.php → ...dential/CredentialRepositoryInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ml/Document/DocumentRegistryInterface.php → ...ml/Document/DocumentRegistryInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.