PHPackages                             kigkonsult/phpincexsdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. kigkonsult/phpincexsdk

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

kigkonsult/phpincexsdk
======================

PhpIncExSdk is the PHP SDK implementation of rfc8727, JSON Binding of the Incident Object Description Exchange Format (rfc7970)

v1.0(3y ago)03LGPL-3.0-or-laterPHPPHP &gt;=8.0

Since Jun 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/iCalcreator/PhpIncExSdk)[ Packagist](https://packagist.org/packages/kigkonsult/phpincexsdk)[ Fund](https://paypal.me/kigkonsult)[ RSS](/packages/kigkonsult-phpincexsdk/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

PhpIncExSdk
===========

[](#phpincexsdk)

is the PHP SDK implementation of

- [rfc8727](https://www.rfc-editor.org/info/rfc8727), JSON Binding of the Incident Object Description Exchange Format ([rfc7970](https://www.rfc-editor.org/info/rfc7970))
- supports json parse/write and the IODEFdocument class instance [rfc8727](https://www.rfc-editor.org/info/rfc8727) validation.

#### Usage

[](#usage)

For package class and property structure, examine [rfc8727](https://www.rfc-editor.org/info/rfc8727) *3.1. Classes and Elements*.

All classes has a (no-arg) factory method, some also with factory method and mandatory properties, ex `IncidentID::factoryNameId( name, id )`.

All properties has `get`,`set` and `isSet` methods, for *array* properties also `add` method.

To support the usage of unique id's (`IncidentID::id`, `IndicatorID::id`, `*::observable-id`, `*::uid-ref` etc), the (static) method `::createGUID()` is available, return a v4 guid.

###### the (entry) PhpIncExSdk class methods :

[](#the-entry-phpincexsdk-class-methods-)

Properties, equipped with `get` and `set` methods

- `dto` *IODEFdocument instance*
- `jsonString` *string*

`factory( [ jsonString [, dto ]] )`

- Class factory method
- `jsonString` *string*
- `dto` *IODEFdocument class instance*
- return *static*
- static

`factoryJsonParse( jsonString )`

- Class factory method, parse jsonString into (internal dto) IODEFdocument instance
- (with json default flags JSON\_OBJECT\_AS\_ARRAY | JSON\_THROW\_ON\_ERROR)
- `jsonString` *string*
- return *static*
- throws *RuntimeException*
- static

`factoryJsonWrite( dto [ prettyPrint] )`

- Class factory method, write IODEFdocument instance into (internal) jsonString
- `dto` *IODEFdocument class instance*
- `prettyPrint` *bool* default false
- return *static*
- throws *RuntimeException*
- static

`function jsonParse( [ jsonString [, flags] )`

- Parse jsonString into (internal dto) IODEFdocument class instance
- `jsonString` *string*
- `flags` *int* default JSON\_OBJECT\_AS\_ARRAY | JSON\_THROW\_ON\_ERROR
- return *static*
- throws *RuntimeException*

`jsonWrite( [ dto [, prettyPrint [, flags ]]] )`

- Write IODEFdocument instance into (internal) jsonString
- `dto` *IODEFdocument class instance*
- `prettyPrint` *bool* default false
- `flags` *int* default JSON\_UNESCAPED\_SLASHES | JSON\_THROW\_ON\_ERROR
- return *static*
- throws *RuntimeException*

`validateDto( [ dto [, result ]] )`

- Validate IODEFdocument class instance
- `dto` *IODEFdocument class instance*
- `result` *array* contain opt missing required parts on false return
- return *bool* true on success
- throws *RuntimeException*

###### Example

[](#example)

Parse [rfc8727](https://www.rfc-editor.org/info/rfc8727) json string into a IODEFdocument class instance

```
