PHPackages                             danielstieber/coda-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. danielstieber/coda-php

ActiveLibrary[API Development](/categories/api)

danielstieber/coda-php
======================

CodaPHP is a library that makes it easy to use Coda API in web projects.

0.4.0(3y ago)306.4k↓34.8%52MITPHPPHP &gt;=7.0.0

Since Nov 12Pushed 3y ago3 watchersCompare

[ Source](https://github.com/danielstieber/CodaPHP)[ Packagist](https://packagist.org/packages/danielstieber/coda-php)[ RSS](/packages/danielstieber-coda-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (10)Used By (2)

CodaPHP
=======

[](#codaphp)

[![Latest Stable](https://camo.githubusercontent.com/6b78217d91ac422d366525dbc4c5cbb69648cab8f0533e09ed54ff8a340d2694/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f64616e69656c737469656265722f636f64617068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/danielstieber/codaphp/releases)[![Coda API Version](https://camo.githubusercontent.com/e463e1e5ca3e07b618efbdac2586d137a8960673743aba58c43169fe193b1d17/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64615f4150495f76657273696f6e2d312e332e302d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](https://coda.io/developers/apis/v1)[![Downloads](https://camo.githubusercontent.com/2146b0e30068e017a119f76d08a5e4abd83335c5155fcd156df88b8b10c91d81/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c737469656265722f636f64612d7068703f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/2146b0e30068e017a119f76d08a5e4abd83335c5155fcd156df88b8b10c91d81/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c737469656265722f636f64612d7068703f7374796c653d666c61742d737175617265)

- [Quickstart](#Quickstart)
- [Detailed Documentation](#Documentation)
- [Doc &amp; Pack Analytics](#Analytics)
- [Caching](#Caching)
- [Changelog](#Changelog)

CodaPHP is a library that makes it easy to use data from [Coda](https://www.coda.io) docs in web projects by using the [Coda API](https://coda.io/developers/apis/v1).

Easily use all available API calls with one library including

- List all documents
- Read data from tables, formulas and controls
- Add/modify rows
- Manage doc permissions
- and a lot more

→ [**Get 10$ discount on Coda paid plans when signing up with this link**](https://coda.io/?r=Qjx7OzpmTa2L6IPfkY-anw)

Quickstart
----------

[](#quickstart)

### Installation and basic usage

[](#installation-and-basic-usage)

Install the library through [Composer](http://getcomposer.org/):

```
php composer.phar require danielstieber/coda-php
```

and add it to your project:

```
require './vendor/autoload.php';
$coda = new CodaPHP\CodaPHP('');

// List all your docs
$result = $coda->listDocs();
var_dump($result);
```

### Handling table data

[](#handling-table-data)

Let's assume you have the table 'Products' in your Coda doc:

#### Products

[](#products)

Title ⚑PriceStatusGoatmilk14.90available ▼Goatmeat38.90available ▼```
// Get the price of the goatmilk
$docId = $coda->getDocId('');

// Lists only Products with status 'available' (currently only one filter allowed)
$availableProducts = $coda->listRows($docId, 'Products', ['query' => ['status' => 'available']]);

// Show value of one cell
$result = $coda->getRow($docId, 'Products', 'Goatmilk');
var_dump($result['values']['Price']);
// Will show you 'float(14.90)'

// Add the new product 'Goatcheese'
if($coda->insertRows($docId, 'Products', ['Title' => 'Goatcheese', 'Price' => 23.50, 'Status' => 'available'])) {
  echo 'Product added';
}

// Change the status of the product 'Goatmilk' to 'sold out'
if($coda->insertRows($docId, 'Products', ['Title' => 'Goatmilk', 'Status' => 'sold out'], ['Title'])) {
  echo 'Product updated';
}
```

### Triggering automations

[](#triggering-automations)

Since May 2022, Coda automations can be triggered via webhooks – and via CodaPHP. To trigger an automation, the automation must be set to "Webhook invoked". To run the automation you need the doc ID an the ID of the automation rule. You can find the rule ID when you click on the 3 dots (kebap menu) above the rule step settings.

```
// Trigger the automation
$result = $coda->runAutomation('', '');
```

Overview
--------

[](#overview)

This is a personal side project. If you have any suggestions, find bugs or want to contribute, don't hesitate to contact me. You can use the [offical Coda community](https://community.coda.io/) to asks questions and reach out as well.

### Token

[](#token)

Generate your token in the Coda profile settings. *Notice: Everyone with this token has full access to all your docs!*

### Methods

[](#methods)

The method names are inspired by the wording of the [official Coda API documentation](https://coda.io/developers/apis/v1beta1) and are listed below.

### Parameters

[](#parameters)

All parameters can be found in the [official Coda API documentation](https://coda.io/developers/apis/v1beta1). Just add an associative array with your parameters to selected functions. The parameter *useColumnNames* is set true by default in all 'row' functions. I list the important ones below.

### Response

[](#response)

In case of success, responses are mostly untouched but converted to PHP arrays. Exception is `insertRow()` function, which provides a boolean true in case of success. In case of an error, the response includes the statusCode and provided error message, also untouched and converted to an array.

### Cache data

[](#cache-data)

Every API call may take a few seconds. It is recommended to store results and only call for new when necessary. The library provides a simple caching mechanic to store received data in a .codaphp\_cache folder. **This mechanic is optional** and needs to be activated. Learn more in the [caching instructions](#Caching)

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

[](#documentation)

```
$coda = new CodaPHP(''); // Create instance of CodaPHP
```

### Docs

[](#docs)

```
$coda->getDocId(''); // Get the id of a doc

$coda->listDocs(); // List all docs you have access to
$coda->listDocs(['query' => 'todo']);  // List docs filtered by searchquery 'todo'
$coda->getDoc(''); // Get a specific doc
$coda->createDoc('My new doc'); // Create a new doc
$coda->createDoc('Copy of my old doc', ''); // Copy a doc
```

### Pages (former Folders &amp; Sections)

[](#pages-former-folders--sections)

```
$coda->listPages(''); // List all sections in a doc
$coda->getPage('', ''); // Get a section in a doc
```

### Tables/Views, Columns and Rows

[](#tablesviews-columns-and-rows)

```
$coda->listTables(''); // List all tables in a doc
$coda->getTable('', ''); // Get a table in a doc

$coda->listColumns('', ''); // List all columns in a table
$coda->getColumn('', '', ''); // Get a column in a table

$coda->listRows('', ''); // List all row in a table
$coda->insertRows('', '', [['' => '']], ['']); // Insert/updates a row in a table

// Examples:
$coda->insertRows('', 'todos', ['title' => 'Shower']); // Adds one row to 'todo'
$coda->insertRows('', 'todos', [['title' => 'Wash dishes'], ['title' => 'Clean car']]); // Adds two rows to 'todo'
$coda->insertRows('', 'todos', [['title' => 'Shower', 'status' => 'done'], ['title' => 'Buy goatcheese']], ['title']); // Updates the status of 'Shower' and inserts a new todo

$coda->updateRow('', '', '', ['' => '']); // Updates a row in a table
$coda->getRow('', '', ''); // Get a row in a table
$coda->deleteRow('', '', ''); // Deletes a row in a table
```

### Working with Views

[](#working-with-views)

Since Coda API Version 1.0.0 there are no seperate view methods. All view operations can be done via the table methods.

### Pushing Buttons

[](#pushing-buttons)

```
$coda->pushButton('', '', '', 'clearCache(); // Clears the whole cache
```

#### Control cache inside the doc

[](#control-cache-inside-the-doc)

A simple way to control the cache status from the coda doc is a button that triggers the clear cache method.

```
$coda = new CodaPHP('', true);
if(isset($_GET['clearCache'])) {
	$coda->clearCache();
}
```

Now you can add a "open hyperlink"-button in your doc that opens . After clicking the button the website will receive the latest data and saves it in the cache again. [![clear cache button](https://camo.githubusercontent.com/00701cc2c5dc72869dbd61eda8a01f05e4b79d6829dae93b0599eb33bd21b0cf/68747470733a2f2f692e696d6775722e636f6d2f697434726b78562e706e67)](https://camo.githubusercontent.com/00701cc2c5dc72869dbd61eda8a01f05e4b79d6829dae93b0599eb33bd21b0cf/68747470733a2f2f692e696d6775722e636f6d2f697434726b78562e706e67)

Changelog
---------

[](#changelog)

### 0.4.0 (August 28, 2022)

[](#040-august-28-2022)

- Update to API version 1.3.0
- New features:
    - Added Analytics endpoints
- Bug fixes:
    - Improved getDocId() regex for better matching

### 0.3.0 (May 24, 2022)

[](#030-may-24-2022)

- Update to API version 1.2.6.
- New features:
    - Trigger "Webhook invoked" automations

### 0.2.0 (January 3, 2021)

[](#020-january-3-2021)

- Update to API version 1.1.0.
- New features:
    - Added ACL permission management
    - Added optional caching

### 0.1.0 (August 15, 2020)

[](#010-august-15-2020)

- Update to API version 1.0.0.
- Breaking changes:
    - Sections &amp; Folders have been replaced by pages
    - Removed 'view' methods. You can access views via table methods.
- New features:
    - Added mutation status method You can read more about API version 1.0.0 [here](https://community.coda.io/t/launched-coda-api-v1/17248)

### 0.0.4 (February 16, 2020)

[](#004-february-16-2020)

- Updated to API version 0.2.4-beta. New features:
    - Pushing buttons inside of tables &amp; views
    - Getting and interacting with views
    - Creating docs in folders
    - Ability to disable parsing of cell values

### 0.0.3 (March 16, 2019)

[](#003-march-16-2019)

- Fixed an issue with using queries in listRows (Thanks to [Al Chen](https://github.com/albertc44) from Coda for mentioning this)

### 0.0.2 (November 15, 2018)

[](#002-november-15-2018)

- Fixed an issue regarding table names with special characters (Thanks to Oleg from Coda for mentioning this)

### 0.0.1 (November 11, 2018)

[](#001-november-11-2018)

- Initial version based on v0.1.1-beta of Coda API

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% 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 ~197 days

Recently: every ~230 days

Total

8

Last Release

1360d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17246741?v=4)[Daniel Stieber](/maintainers/danielstieber)[@danielstieber](https://github.com/danielstieber)

---

Top Contributors

[![danielstieber](https://avatars.githubusercontent.com/u/17246741?v=4)](https://github.com/danielstieber "danielstieber (22 commits)")[![p5ych0](https://avatars.githubusercontent.com/u/4077843?v=4)](https://github.com/p5ych0 "p5ych0 (1 commits)")

---

Tags

codacomposerphpapilibrarycoda

### Embed Badge

![Health badge](/badges/danielstieber-coda-php/health.svg)

```
[![Health](https://phpackages.com/badges/danielstieber-coda-php/health.svg)](https://phpackages.com/packages/danielstieber-coda-php)
```

###  Alternatives

[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[chatapi/whatsapp

Library for WhatsApp api

453.6k](/packages/chatapi-whatsapp)

PHPackages © 2026

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