Download the PHP package danielstieber/coda-php without Composer
On this page you can find all versions of the php package danielstieber/coda-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danielstieber/coda-php
More information about danielstieber/coda-php
Files in danielstieber/coda-php
Package coda-php
Short Description CodaPHP is a library that makes it easy to use Coda API in web projects.
License MIT
Informations about the package coda-php
CodaPHP
- Quickstart
- Detailed Documentation
- Doc & Pack Analytics
- Caching
- Changelog
CodaPHP is a library that makes it easy to use data from Coda docs in web projects by using the Coda API.
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
Quickstart
Installation and basic usage
Install the library through Composer:
and add it to your project:
Handling table data
Let's assume you have the table 'Products' in your Coda doc:
Products
Title ⚑ | Price | Status |
---|---|---|
Goatmilk | 14.90 | available ▼ |
Goatmeat | 38.90 | available ▼ |
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.
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 to asks questions and reach out as well.
Token
Generate your token in the Coda profile settings. Notice: Everyone with this token has full access to all your docs!
Methods
The method names are inspired by the wording of the official Coda API documentation and are listed below.
Parameters
All parameters can be found in the official Coda API documentation. 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
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
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
Documentation
Docs
Pages (former Folders & Sections)
Tables/Views, Columns and Rows
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
Formulas and Controls
Manage permissions
Learn more about permission settings with the API here.
Run automations / trigger webhooks
Account and other
Analytics
Caching
The library can cache API requests in JSON files. If caching is activated, the library tries to create a .codaphp_cache
folder in your project root. If it can't create or find the folder, it will deactivate caching. You can also create the folder on your own and set CHMOD so the library can read & write files in it. Only doc data & content will be cached, no permissions, links or mutation status!
By default, the cache will expire after 7 days. You can manually change the expiry time.
You can also clear the cache manually
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.
Now you can add a "open hyperlink"-button in your doc that opens https://yourdomain.com/?clearCache. After clicking the button the website will receive the latest data and saves it in the cache again.
Changelog
0.4.0 (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)
- Update to API version 1.2.6.
- New features:
- Trigger "Webhook invoked" automations
0.2.0 (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)
- Update to API version 1.0.0.
- Breaking changes:
- Sections & 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
0.0.4 (February 16, 2020)
- Updated to API version 0.2.4-beta. New features:
- Pushing buttons inside of tables & views
- Getting and interacting with views
- Creating docs in folders
- Ability to disable parsing of cell values
0.0.3 (March 16, 2019)
- Fixed an issue with using queries in listRows (Thanks to Al Chen from Coda for mentioning this)
0.0.2 (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)
- Initial version based on v0.1.1-beta of Coda API