{"id":20838460,"url":"https://github.com/reload/openplatform-client","last_synced_at":"2025-03-12T09:43:04.431Z","repository":{"id":44634065,"uuid":"212184274","full_name":"reload/openplatform-client","owner":"reload","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-03T10:46:18.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T23:17:35.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reload.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-01T19:38:44.000Z","updated_at":"2022-02-03T10:32:45.000Z","dependencies_parsed_at":"2022-09-01T04:10:49.338Z","dependency_job_id":null,"html_url":"https://github.com/reload/openplatform-client","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reload%2Fopenplatform-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reload%2Fopenplatform-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reload%2Fopenplatform-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reload%2Fopenplatform-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reload","download_url":"https://codeload.github.com/reload/openplatform-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243196618,"owners_count":20251857,"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":[],"created_at":"2024-11-18T01:10:22.977Z","updated_at":"2025-03-12T09:43:04.402Z","avatar_url":"https://github.com/reload.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenPlatform client lib.\n\n[![](https://github.com/reload/openplatform-client/workflows/Build%20and%20test/badge.svg)](https://github.com/reload/openplatform-client/actions?query=workflow%3A%22Build+and+test%22)\n[![](https://github.com/reload/openplatform-client/workflows/Code%20style%20review/badge.svg)](https://github.com/reload/openplatform-client/actions?query=workflow%3A%22Code+style+review%22)\n[![codecov](https://codecov.io/gh/reload/openplatform-client/branch/master/graph/badge.svg)](https://codecov.io/gh/reload/openplatform-client)\n\nThis package provides a simple interface to\n[OpenPlatform](https://openplatform.dbc.dk/v3/) provided by DBC.\n\n## Installation\n\n```shell\ncomposer require danskernesdigitalebibliotek/openplatform\n```\n\n## Usage\n\nA working example:\n\n``` php\n$op = new OpenPlatform($token);\n\n$res = $op-\u003esearch('harry AND potter')\n    -\u003ewithFields(['pid', 'title'])\n    -\u003eexecute();\n\nforeach ($res-\u003egetData() as $material) {\n    print $material['pid'][0] . ': ' . $material['title'][0] . \"\\n\";\n}\n```\n\nIn short:\n\n1. Create an OpenPlatform instance and supply it a token (see [How to\n   obtain a token](#how-to-obtain-a-token)).\n2. Call a method that returns a `*Request` object.\n3. Chain with `with*` methods to set parameters.\n4. End with `execute` to get a lazy loading result.\n5. Get response data from getters on the response object.\n\n### Generic requests\n\nAs this library is far from complete in regard to the amount of calls\nimplemented, there's also a generic request that'll work with any\nOpenPlatform call that: a) takes an access token and b) has statusCode\nin the reply (which should be all of them).\n\n### Lazy loading\n\nThis library uses [Symfony\nHttpClient](https://symfony.com/doc/current/components/http_client.html),\nso responses only perform the request when you ask for the data. Also\nmeans that you can create multiple responses, and the requests will be\nperformed in parallel when accessing data on any one.\n\n## CLI command\n\nThe library includes a CLI command, `bin/openplatform`, which\nfunctions both as a practical example, and as an exploratory tool. You\nneed to install dev dependence for the project in order to use it.\n\n## How to obtain a token\n\nYou can get a token keyed to a user by authenticating the user with\n[Adgangsplatformen](https://github.com/DBCDK/hejmdal). You can use\n[oauth2-adgangsplatformen](https://github.com/reload/oauth2-adgangsplatformen)\nfor communicating with the service.\n\nIf you have a client id and secret, you can generate a token at\nhttps://openplatform.dbc.dk/v3/ .\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freload%2Fopenplatform-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freload%2Fopenplatform-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freload%2Fopenplatform-client/lists"}