{"id":23413808,"url":"https://github.com/lanthaler/jsonld","last_synced_at":"2025-05-15T17:06:37.599Z","repository":{"id":2829763,"uuid":"3832297","full_name":"lanthaler/JsonLD","owner":"lanthaler","description":"JSON-LD processor for PHP","archived":false,"fork":false,"pushed_at":"2023-10-02T13:40:13.000Z","size":646,"stargazers_count":337,"open_issues_count":28,"forks_count":61,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-10-30T03:35:54.164Z","etag":null,"topics":["hypermedia","json-ld","linked-data","php","rest","schema-org","semantic-web","web-api"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lanthaler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-03-26T12:01:28.000Z","updated_at":"2024-10-22T12:15:51.000Z","dependencies_parsed_at":"2024-06-18T10:57:54.960Z","dependency_job_id":"9be1b7c7-22f9-408c-90e5-cd5bc05fd895","html_url":"https://github.com/lanthaler/JsonLD","commit_stats":{"total_commits":371,"total_committers":12,"mean_commits":"30.916666666666668","dds":"0.040431266846361225","last_synced_commit":"537e68e87a6bce23e57c575cd5dcac1f67ce25d8"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanthaler%2FJsonLD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanthaler%2FJsonLD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanthaler%2FJsonLD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanthaler%2FJsonLD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lanthaler","download_url":"https://codeload.github.com/lanthaler/JsonLD/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hypermedia","json-ld","linked-data","php","rest","schema-org","semantic-web","web-api"],"created_at":"2024-12-22T19:55:44.795Z","updated_at":"2025-05-15T17:06:32.576Z","avatar_url":"https://github.com/lanthaler.png","language":"PHP","readme":"JsonLD [![Continuous integration](https://github.com/lanthaler/JsonLD/actions/workflows/ci.yaml/badge.svg)](https://github.com/lanthaler/JsonLD/actions/workflows/ci.yaml)\n==============\n\nJsonLD is a fully conforming [JSON-LD](http://www.w3.org/TR/json-ld/)\nprocessor written in PHP. It is extensively tested and passes the\n[official JSON-LD test suite](https://github.com/json-ld/tests).\n\nThere's an [online playground](http://www.markus-lanthaler.com/jsonld/playground/)\nwhere you can evaluate the processor's basic functionality.\n\nAdditionally to the features defined by the [JSON-LD API specification](http://www.w3.org/TR/json-ld-api/),\nJsonLD supports [framing](http://json-ld.org/spec/latest/json-ld-framing/)\n(including [value matching](https://github.com/json-ld/json-ld.org/issues/110),\n[deep-filtering](https://github.com/json-ld/json-ld.org/issues/110),\n[aggressive re-embedding](https://github.com/json-ld/json-ld.org/issues/119), and\n[named graphs](https://github.com/json-ld/json-ld.org/issues/118)) and an experimental\n[object-oriented interface for JSON-LD documents](https://github.com/lanthaler/JsonLD/issues/15).\n\n\nInstallation\n------------\n\nThe easiest way to install `JsonLD` is by requiring it with [Composer](https://getcomposer.org/).\n\n```\ncomposer require ml/json-ld\n```\n\n... and including Composer's autoloader to your project\n\n```php\nrequire('vendor/autoload.php');\n```\n\nOf course, you can also download JsonLD as\n[ZIP archive](https://github.com/lanthaler/JsonLD/releases) from Github.\n\nJsonLD requires PHP 5.3 or later.\n\n\nUsage\n------------\n\nThe library supports the official [JSON-LD API](http://www.w3.org/TR/json-ld-api/) as\nwell as a object-oriented interface for JSON-LD documents (not fully implemented yet,\nsee [issue #15](https://github.com/lanthaler/JsonLD/issues/15) for details).\n\nAll classes are extensively documented. Please have a look at the source code.\n\n```php\n// Official JSON-LD API\n$expanded = JsonLD::expand('document.jsonld');\n$compacted = JsonLD::compact('document.jsonld', 'context.jsonld');\n$framed = JsonLD::frame('document.jsonld', 'frame.jsonld');\n$flattened = JsonLD::flatten('document.jsonld');\n$quads = JsonLD::toRdf('document.jsonld');\n\n// Output the expanded document (pretty print)\nprint JsonLD::toString($expanded, true);\n\n// Serialize the quads as N-Quads\n$nquads = new NQuads();\n$serialized = $nquads-\u003eserialize($quads);\nprint $serialized;\n\n// And parse them again to a JSON-LD document\n$quads = $nquads-\u003eparse($serialized);\n$document = JsonLD::fromRdf($quads);\n\nprint JsonLD::toString($document, true);\n\n// Node-centric API\n$doc = JsonLD::getDocument('document.jsonld');\n\n// get the default graph\n$graph = $doc-\u003egetGraph();\n\n// get all nodes in the graph\n$nodes = $graph-\u003egetNodes();\n\n// retrieve a node by ID\n$node = $graph-\u003egetNode('http://example.com/node1');\n\n// get a property\n$node-\u003egetProperty('http://example.com/vocab/name');\n\n// add a new blank node to the graph\n$newNode = $graph-\u003ecreateNode();\n\n// link the new blank node to the existing node\n$node-\u003eaddPropertyValue('http://example.com/vocab/link', $newNode);\n\n// even reverse properties are supported; this returns $newNode\n$node-\u003egetReverseProperty('http://example.com/vocab/link');\n\n// serialize the graph and convert it to a string\n$serialized = JsonLD::toString($graph-\u003etoJsonLd());\n```\n\n\nCommercial Support\n------------\n\nCommercial support is available on request.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanthaler%2Fjsonld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flanthaler%2Fjsonld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanthaler%2Fjsonld/lists"}