An open-source, lightweight PHP library for working with Web of Things (WoT) Thing Descriptions (TD). It includes features to parse, validate, and generate TD documents. It adheres to the W3C TD JSON Schema but does not follow the W3C WoT Scripting API.
- Describe and document Thing Descriptions programmatically.
- Generate compliant Thing Descriptions programmatically.
- Parse Thing Descriptions from JSON format.
- Validate Thing Descriptions against the W3C WoT TD schema.
Install the library via Composer:
composer require wot-php/wot-td
use WoT\Core\Describe\ThingDescription;
use WoT\Core\Generate\Generator;
$td = new ThingDescription();
$td->setTitle("Smart Thermostat")
->addProperty("temperature", [
"type" => "number",
"forms" => [
[
"href" => "/properties/temperature",
"op" => ["readproperty"],
],
],
])
->addProperty("status", [
"type" => "boolean",
"forms" => [
[
"href" => "/properties/status",
"op" => ["readproperty"],
],
],
]);
$json = Generator::generate($td);
echo $json;
See CONTRIBUTING.md for contribution guidelines.
This library is licensed under the MIT License.