PHPackages                             teamzac/openzac-api-php - 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. teamzac/openzac-api-php

ActiveLibrary[API Development](/categories/api)

teamzac/openzac-api-php
=======================

Official PHP API client for openzac.com

2.0(8y ago)025MITPHPPHP &gt;=5.7

Since Nov 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/teamzac/openzac-api-php)[ Packagist](https://packagist.org/packages/teamzac/openzac-api-php)[ RSS](/packages/teamzac-openzac-api-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

OpenZac API PHP Client
======================

[](#openzac-api-php-client)

This is the PHP client for the OpenZac API.

Getting Started
---------------

[](#getting-started)

You'll need an API key. Get one at .

Creating an instance of the client
----------------------------------

[](#creating-an-instance-of-the-client)

```
$apiToken = 'YOUR_TOKEN';
$client = new TeamZac\OpenZac\OpenZac($apiToken);
```

### In Laravel

[](#in-laravel)

Include the service provider in your config/app.php file:

```
TeamZac\OpenZac\OpenZacServiceProvider::class,
```

Publish the package's config file:

```
$ php artisan vendor:publish --provider="TeamZac\OpenZac\OpenZacServiceProvider"
```

Add your API token, preferably to your .env file:

```
OPENZAC_API_TOKEN=YOUR_TOKEN

```

Or set it directly in the config file:

```
'token' => 'YOUR_TOKEN'
```

The service provider binds a singleton instance of `TeamZac\OpenZac\OpenZac` to the IoC container, which you can access using the key 'OpenZac':

```
app('OpenZac');
```

Using the client
----------------

[](#using-the-client)

The remainder of the documentation will assume you're using Laravel. If not, you can replace `app('OpenZac)` with a normal instance of `TeamZac\OpenZac\OpenZac`.

We're fleshing out a fluent interface to the API, but for now you can just use the `get()` method on the client, providing a URI path and optionally any parameters or headers you wish to pass along:

```
app('OpenZac')->get('entities/austin-texas');

app('OpenZac')->get('sales-tax/collections/2016/11', [
    'page' => 2,
    'take' => 25
]);
```

Retreiving Entities
-------------------

[](#retreiving-entities)

We do have a minimally developed interface for accessing 'entity' resources. You can access this interface using the `entities` attribute on the OpenZac instance:

```
app('OpenZac')->entities;
```

There are two public methods on this resource: `all()` and `find()`.

### all()

[](#all)

`app('OpenZac')->entities->all()` is the same as calling `get('entities')`. You can pass an array of query parameters as the lone argument:

```
app('OpenZac')->entities->all(['page' => 3]);
```

### find()

[](#find)

The `find()` method takes an entity ID as its lone parameter, and will retrieve a single entity record.

```
app('OpenZac')->entities->find('austin-texas');
```

Resources and Collections
-------------------------

[](#resources-and-collections)

API calls return either an instance of `TeamZac\OpenZac\Support\Resource` or `TeamZac\OpenZac\Support\ResourceCollection`.

### TeamZac\\OpenZac\\Support\\Resource

[](#teamzacopenzacsupportresource)

Right now this is just a simple wrapper for the response which allows you to access data as properties on the Resource object.

```
$austin = app('OpenZac')->entities->find('austin-texas');
$austin->name;
// prints 'Austin'
```

The infrastructure is in place to provide more helpful functionality by using this as a base class. Future development plans include each resource having it's own subclass. This will allow for casting attributes to certain data types and potentially other valuable features.

### TeamZac\\OpenZac\\Support\\ResourceCollection

[](#teamzacopenzacsupportresourcecollection)

This is a simple wrapper around responses that return more than a single resource. It has a couple of public methods which may be useful:

`data()` returns the resources, which are subclasses of `TeamZac\OpenZac\Support\Resource`.

`meta()` returns any metadata associated with the response. Typically this will just be information related to pagination where applicable.

`nextPage()` returns the next page number or `null` if it does not exist.

`previousPage()` returns the previous page number or `null` if it does not exist.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~296 days

Total

2

Last Release

3218d ago

Major Versions

1.0 → 2.02017-09-09

PHP version history (2 changes)1.0PHP &gt;=5.5.9

2.0PHP &gt;=5.7

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fd7317d975889db1c4dc0aec0dfcd3f9f4e284634e6719891d3f47f46238be6?d=identicon)[teamzac](/maintainers/teamzac)

---

Top Contributors

[![chadjanicek](https://avatars.githubusercontent.com/u/18754689?v=4)](https://github.com/chadjanicek "chadjanicek (3 commits)")

---

Tags

open data

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/teamzac-openzac-api-php/health.svg)

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

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M962](/packages/statamic-cms)[craftcms/cms

Craft CMS

3.6k3.6M3.0k](/packages/craftcms-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[smodav/mpesa

M-Pesa API implementation

16467.9k1](/packages/smodav-mpesa)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1223.7k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

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