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)

14857PHP

Since Jun 23Pushed 7y 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 yesterday

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 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity40

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://www.gravatar.com/avatar/ded58e5e0d0856e6a7fbd7dd2bd6d429ac856418e8f50bbbe52b8fecc467cdaa?d=identicon)[whoisryosuke](/maintainers/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

[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)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP wrapper for the Meilisearch API

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

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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