{"id":20171071,"url":"https://github.com/pear/net_hl7","last_synced_at":"2025-04-10T02:41:18.478Z","repository":{"id":2109588,"uuid":"3051329","full_name":"pear/Net_HL7","owner":"pear","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-23T07:41:42.000Z","size":57,"stargazers_count":47,"open_issues_count":2,"forks_count":29,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-24T04:11:28.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pear.php.net/package/Net_HL7","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/pear.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":"2011-12-26T11:20:58.000Z","updated_at":"2023-06-20T22:32:34.000Z","dependencies_parsed_at":"2022-09-02T05:50:44.827Z","dependency_job_id":null,"html_url":"https://github.com/pear/Net_HL7","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNet_HL7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNet_HL7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNet_HL7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNet_HL7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pear","download_url":"https://codeload.github.com/pear/Net_HL7/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144918,"owners_count":21055008,"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-14T01:23:12.795Z","updated_at":"2025-04-10T02:41:18.460Z","avatar_url":"https://github.com/pear.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HL7 API: README\n\n\n## Contents\n\n1.0 Introduction\u003cbr/\u003e\n2.0 Usage\u003cbr/\u003e\n2.1 Creating messages\u003cbr/\u003e\n2.2 Sending/receiving\u003cbr/\u003e\n\n\n## 1.0 Introduction\n\n\nThis is the PHP HL7 API. It is a very simple, but rather flexible API\nfor use in PHP applications. The API is a word for word translation of\nthe Perl Net-HL7 package, based on version 0.72.\n\nThe focus of this API is on providing functionality for the\ncomposition, manipulation and decomposition of HL7 messages, not\nproviding hundreds of prefab HL7 messages. In HL7 terms: this API\nfocuses on the HL7 syntax, not the semantics. This makes the API\nsupport all versions that use the classic HL7 syntax, that is,\nversions untill 3.x. This API does not do XML!\n\n\n## 2.0 Usage\n\n### 2.1 Creating messages\n\nTo create an HL7 message, simply do this:\n\n```\n$msg = new Net_HL7_Message();\n```\n\nthis gives you an empty message, that doesn't containt ANY segments\n(not even the header segment). You might also have a string\nrepresentation of your message at hand, in which case you can do this:\n\n```\n$msg = new Net_HL7_Message(\u003cyour string\u003e);\n```\n\nMake sure to escape any characters that have special meaning in PHP!\n\n\n### 2.2 Sending/receiving\n\nA full example of sending and receiving a message is listed here,\nassuming you have an HL7 server on your localhost, listening to port\n12002 (you might want to use the hl7d from the Perl HL7 Toolkit\npackage as a simple test server; http://hl7toolkit.sourceforge.net/):\n\n```php\n\u003c?php\nrequire_once \"Net/HL7/Segments/MSH.php\";\nrequire_once \"Net/HL7/Message.php\";\nrequire_once \"Net/HL7/Connection.php\";\n\n$msg  = new Net_HL7_Message();\n$msg-\u003eaddSegment(new Net_HL7_Segments_MSH());\n\n$seg1 = new Net_HL7_Segment(\"PID\");\n\n$seg1-\u003esetField(3, \"XXX\");\n\n$msg-\u003eaddSegment($seg1);\n\necho \"Trying to connect\";\n$socket = new Net_Socket();\n$success = $socket-\u003econnect(\"localhost\", 12002);\n\nif ($success instanceof PEAR_Error) {\n    echo \"Error: {$success-\u003egetMessage()}\";\n    exit(-1);\n}\n\n$conn = new Net_HL7_Connection($socket);\n\necho \"Sending message\\n\" . $msg-\u003etoString(true);\n\n$resp = $conn-\u003esend($msg);\n\n$resp || exit(-1);\n\necho \"Received answer\\n\" . $resp-\u003etoString(true);\n\n$conn-\u003eclose();\n?\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpear%2Fnet_hl7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpear%2Fnet_hl7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpear%2Fnet_hl7/lists"}