PHPackages                             openthc/api - 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. [API Development](/categories/api)
4. /
5. openthc/api

ActiveLibrary[API Development](/categories/api)

openthc/api
===========

OpenTHC API

7541115[5 issues](https://github.com/openthc/api/issues)[2 PRs](https://github.com/openthc/api/pulls)PHPCI passing

Since Jun 11Pushed 3mo ago10 watchersCompare

[ Source](https://github.com/openthc/api)[ Packagist](https://packagist.org/packages/openthc/api)[ RSS](/packages/openthc-api/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (6)Used By (0)

OpenTHC Common API
==================

[](#openthc-common-api)

Provides a common reference and API end-point specification for implementing Cannabis Data Systems.

The world of cannabis regulatory compliance is complex and large. There are hundreds of vendors, each with a common goal but without an API, partial API, or have implemented a unique flavor. The goal of this interface is to provide a basis for data interoperability.

It's our hope that others in the cannabis industry could adopt, in whole or in part, some of the concepts and designs published here. Open Issues, submit PRs, etc and we can build the future we all want to see.

A Common Data Model
-------------------

[](#a-common-data-model)

An important first step for bringing the industry together is to start talking in with common terms, a second is a common interface.

The OpenTHC API Specification aims to define core parts of this data model and suggested interfaces. The API and [data-models](./openapi/components/schema) are defined in the [openapi](./openapi) directory. There are definitions of base-data (ie: [lab-metric](./etc/lab-metric), [product-type](./etc/product-type) in [etc](./etc). Both are defined with [YAML](https://yaml.org/spec/1.2.2/).

Some scripts for processing that YAML into other flavours (JSON, CSV, SQL) are in [bin](./bin). But, YAML is so easy, one can quickly process with their preferred tools.

A Common Interface
------------------

[](#a-common-interface)

The OpenTHC API Module provides a method for reading/writing to a compatible system. A set of standard base data models for objects in the cannabis industry.

This API was heavily influenced by the [Open API Initiative](https://openapis.org/)and the [Data Transfer Project](https://opensource.googleblog.com/2018/07/introducing-data-transfer-project.html)

- Use [International System of Units](https://en.wikipedia.org/wiki/International_System_of_Units) for weight and volume values.
- Use [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) for date and time values.

We provide some base data examples and JSON schema.

Documentation
-------------

[](#documentation)

The documentation has been created using a combination of [Asciidoc](http://asciidoc.org) and [OpenAPI](https://swagger.io).

Asciidoc is in [doc](./doc) and the OpenAPI sources are in [openapi](./openapi)

```
./make.sh docs

```

JSON Schema
-----------

[](#json-schema)

A JSON Schema is published for all the objects in this system, they are located in ./webroot/pub/json-schema These files are constructed from the YAML documentation in ./swagger Sample objects are provided in ./json-example

```
./make.sh docs-openapi

```

Data Models
-----------

[](#data-models)

There is a bunch of "base" data for this industry, Company, Company\_Type, License, License\_Type, Product\_Type, Variety and Laboratory Metrics. Included in the ./etc directory are pre-populated yaml files describing these common objects. Usage of common, unique identifiers for data-fields we all care about will improve interoperablity.

### License Configuration Data

[](#license-configuration-data)

These objects are defined and specific to each Company or License in the system. Includes: Product, Variety, Section, Vehicle (although, Section and Vehicle only exist for backwards compatibility)

### License Operational Data

[](#license-operational-data)

- Crop / Plant
- Inventory Lot
- Lab Sample / Lab Result
- B2B Transaction and B2B Transaction Items
- B2C Transaction and B2C Transaction Items

Testing
-------

[](#testing)

Run the unit tests in ./test

```
./make.sh test

```

You could also use [Prism](https://github.com/stoplightio/prism) for running a mock interface.

Dependencies
------------

[](#dependencies)

This thing depends on Asciidoc/Asciidoctor (Python, Ruby) and some build scripts (JS, PHP, Ruby). Just review the `make.sh` script for the latest information.

See Also
--------

[](#see-also)

-
-
-
-
-
-
-
-
-
- [How to Design the APIs of Tomorrow](https://news.ycombinator.com/item?id=24332418)
- [Ask HN: What is your go-to example for a good REST API?](https://news.ycombinator.com/item?id=11971491)
- [Ask HN: What are good reads for designing APIs?](https://news.ycombinator.com/item?id=12262586)
- [Microsoft REST API Guidelines](https://news.ycombinator.com/item?id=12122828)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance53

Moderate activity, may be stable

Popularity30

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 94.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ddcf41d804b34c0483ade6ebca0b473fcf6cce2e6bf8bdf9056999b6bb48b9c1?d=identicon)[openthc](/maintainers/openthc)

---

Top Contributors

[![djbusby](https://avatars.githubusercontent.com/u/3802734?v=4)](https://github.com/djbusby "djbusby (296 commits)")[![mashiox](https://avatars.githubusercontent.com/u/308284?v=4)](https://github.com/mashiox "mashiox (11 commits)")[![bobbyahines](https://avatars.githubusercontent.com/u/11367967?v=4)](https://github.com/bobbyahines "bobbyahines (6 commits)")[![theCompanyDream](https://avatars.githubusercontent.com/u/1742051?v=4)](https://github.com/theCompanyDream "theCompanyDream (1 commits)")

---

Tags

apicannabisseed-to-saletraceability

### Embed Badge

![Health badge](/badges/openthc-api/health.svg)

```
[![Health](https://phpackages.com/badges/openthc-api/health.svg)](https://phpackages.com/packages/openthc-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
