CodaPHP 0.2 + Demo

I’ve just released a new version of the CodaPHP library and set a simple Demo site & doc.

Library CodaPHP on Github

Demo Frontend (Website) | Backend (Coda Doc) | Github

New in 0.2.0

  • Simple caching mechanic
  • Updated to latest API version
    • Manage User Permissions

Caching

For a quick implementation without worrying about website loading times, I’ve added a simple caching mechanic. This is more of a test right now and has to be activated manually.

// initialize CodaPHP with caching
$coda = new CodaPHP\CodaPHP($apiKey, true);

When activated, CodaPHP tries to create a folder .codaphp_cache in your website root folder. (Depending on your CHMOD settings you might have to create the folder on your own!) The result of every API call with cachable results (e.g. getRow()) will be stored as JSON there.

By default the cache expires (=clears the cache folder) every 7 days when the library is called. This can be set when initializing. Also the cache can be cleared manually.

// initialize CodaPHP with 1 day of cache (in seconds)
$coda = new CodaPHP\CodaPHP($apiKey, true, 1440);
// manually clearing the cache
$coda->clearCache();

For bigger projects or when working with frameworks like Laravel, it might be better to create a custom caching mechanic.

User permissions

Besides the standard methods of the API, I’ve added two simple helper methods that allow to add & remove users very fast just via email:

// Add a user by email
$coda->addUser($docId, 'jondoe@coda.com');
// Add a user by email with readonly permissions and notify via email
$coda->addUser($docId, 'jondoe@coda.com', 'readonly', true);
/// Remove a user from the doc
$coda->deleteUser('jondoe@coda.com');

For more information about permissions read the offical docs and the library readme.

If you have feedback or suggestions just let me know!

5 Likes

That’s awesome! When and if i’ll create a sort of external UI for my apps on coda i’ll give this a try!!!
Thanks @Daniel_Stieber :heart:

2 Likes