I’ve just released a new version of the CodaPHP library and set a simple Demo site & doc.
Library CodaPHP on Github
New in 0.2.0
- Simple caching mechanic
- Updated to latest API version
- Manage User Permissions
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.
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, 'email@example.com'); // Add a user by email with readonly permissions and notify via email $coda->addUser($docId, 'firstname.lastname@example.org', 'readonly', true); /// Remove a user from the doc $coda->deleteUser('email@example.com');
If you have feedback or suggestions just let me know!