PHPackages                             kushy/metrc-php-sdk - 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. kushy/metrc-php-sdk

ActiveLibrary[API Development](/categories/api)

kushy/metrc-php-sdk
===================

An easy to use PHP API for the METRC state licensed seed to sale cannabis API using the Guzzle library. Require, create new instance with API keys, and query any endpoint (GET, POST, PUT, DELETE)

15857PHP

Since Jun 23Pushed 8y ago3 watchersCompare

[ Source](https://github.com/kushyapp/kushy-metrc-php-sdk)[ Packagist](https://packagist.org/packages/kushy/metrc-php-sdk)[ RSS](/packages/kushy-metrc-php-sdk/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Metrc API SDK
=============

[](#metrc-api-sdk)

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

[](#dependencies)

- [Guzzle](http://docs.guzzlephp.org/en/stable/quickstart.html)

Development
-----------

[](#development)

### Quick Start Guide + API Keys

[](#quick-start-guide--api-keys)

1. Install the METRC package with Composer: `composer require 'kushy/metrc-php-sdk'`
2. Require whichever route class you need in your application - in this case we want to access the `/harvests/` endpoint (*assuming you're using PSR-4*):

```
require_once '../../../vendor/autoload.php';

use Kushy\Metrc\Routes\Harvests;
```

3. Create a new instance of the route class (`Harvests`) and pass through your state's abbreviated name (in this case `ca` for California) and Vendor + User API keys:

```
$harvests = new Harvests('ca', $vendorApiKey, $userApiKey);
```

4. Use one of the class methods to query the API - this example grabs the active harvests:

```
$harvests = $metrc->getActive($licenseNumber, $startDate, $endDate);
```

### Tips

[](#tips)

**General**

- [General API Tips](https://api-ca.metrc.com/Documentation/#getting_started_working_with_the_api)
- All API requests (POST/PUT) must be sent in JSON format ([see Guzzle on JSON](http://docs.guzzlephp.org/en/stable/request-options.html#json))
- All dates are ISO 8601 format. See below for time conversion snippets.

**Dates are ISO format**Sending dates to API? Use ISO 8601 formatted date: `0001-01-01T00:00:00+00:00`

```
$lastModifiedStart = date('c', strtotime($startDate));
```

**Quickly get object keys**Copy API response/sample data and do this:

```
/**
 * REGEX for
 * (["'])(?:(?=(\\?))\2.)*?\1:
 * ALT+ENTER to select all found objects
 * Paste
 * Find and replace ": with nothing
 * Find and replace " with $sample->
**/

  "Id": 1,
  "Name": "2014-11-19-Harvest Room-M",
  "HarvestType": "Product",
  "DryingRoomId": 1,
  "DryingRoomName": "Harvest Room",
  "CurrentWeight": 0.0,
  "TotalWasteWeight": 0.0,
  "PlantCount": 70,
  "TotalWetWeight": 40.0,
  "PackageCount": 5,
  "TotalPackagedWeight": 0.0,
  "UnitOfWeightName": "Ounces",
  "LabTestingState": null,
  "LabTestingStateDate": null,
  "IsOnHold": false,
  "HarvestStartDate": "2014-11-19",
  "FinishedDate": null,
  "ArchivedDate": null,
  "LastModified": "0001-01-01T00:00:00+00:00",
  "Strains": []
```

Testing
-------

[](#testing)

Example files are provided in the package for each endpoint and method (GET, POST, PUT, DELETE) to easily test each endpoint manually with properly formed sample data.

> For example, to see a list of all active harvests, copy the code from `test/example/harvests/get-active-harvest.php`.

*I'm looking to implement unit testing soon to ensure package integrity.*

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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://avatars.githubusercontent.com/u/37885061?v=4)[Ryosuke](/maintainers/whoisryosuke)[@whoisryosuke](https://github.com/whoisryosuke)

---

Top Contributors

[![whoisryosuke](https://avatars.githubusercontent.com/u/37885061?v=4)](https://github.com/whoisryosuke "whoisryosuke (3 commits)")[![stoneddesigner](https://avatars.githubusercontent.com/u/31430152?v=4)](https://github.com/stoneddesigner "stoneddesigner (1 commits)")

### Embed Badge

![Health badge](/badges/kushy-metrc-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/kushy-metrc-php-sdk/health.svg)](https://phpackages.com/packages/kushy-metrc-php-sdk)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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