• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ’‘ Unofficial WorkFlowy API written in PHP.

Version

WorkflowyPHP

An unofficial WorkFlowy API written in PHP.


Disclaimer

The aim of the API is to keep things simple. Please keep in mind that it is an unofficial tool, and it may stop working at any time.

So, I strongly recommend you not to manipulate sensitive data with this API, and be sure to make regular backups of your lists.

Installation

By using Composer:

{
    "require": {
        "johansatge/workflowy-php": "0.1"
    }
}

If you do not use Composer, you can download the source files, install them anywhere on your project, and call the providden autoloader file:

<?php require_once '/your/project/root/path/workflowy-php/src/autoload.php';

Usage

Login API

Because of the unofficial status of the API, you have to login first, by using your regular credentials, before being able to perform requests on your data.

use WorkFlowyPHP\WorkFlowy;
use WorkFlowyPHP\WorkFlowyException;
try
{
    $session_id = WorkFlowy::login('[email protected]', 'password');
}
catch (WorkFlowyException $e)
{
    var_dump($e->getMessage());
}

The $session_id variable will be used later, when performing requests.

You have to use your unencoded password in your code. So I strongly advise you to store it in a different file, or ask it once to the user, then store the session ID. (But keep in mind that the session does not last forever.) This is a huge limitation, but for now there is no workaround.

Lists API

Lists-related stuff is managed with the recursive WorkFlowySublist class.

First, you will need to get the main (root) list.

use WorkFlowyPHP\WorkFlowyList;

$list_request = new WorkFlowyList($session_id);
$list = $list_request->getList();

Then, you will be able to perform the following operations on the resulting $list, or its sublists.

Get the informations of a list

Function Returns Description
$list->getID(); string Get the ID of the list
$list->getName(); string Get the name of the list
$list->getDescription(); string Get the description of the list
$list->getParent(); WorkFlowySublist Get the parent of the list
$list->isComplete(); boolean Get the status of the list
$list->getCompletedTime(); int Get the completed time of the list (Unix timestamp)
$list->getLastModifiedTime(); int Get the last modified time of the list (Unix timestamp)
$list->getOPML(); string Get the list and its sublists as an OPML string
$list->getSublists(); array Get the sublists of the list
$list->searchSublist('/My sublist name/'); WorkFlowySublist Returns the first child list matching the given name
$list->searchSublist('/My sublist name/', array('get_all' => true)); array Returns all children lists matching the given name

Edit the informations of a list

Function Parameters Description
$list->setName('My sublist'); string Sets the list name
$list->setDescription('My sublist description'); string Sets the list description
$list->setParent($parent_list, 2); WorkFlowySublist,int Sets the list parent and its position
$list->setComplete(true); boolean Sets the list status
$list->createSublist('My sublist name', 'My sublist description', 9); string,string,int Creates a sublist

The methods below are used to edit data.

Keep in mind that they will send requests to the server, but not update the existing variables.

For instance, if you change the parent of a list and call the getSublists() method on its old parent, the list will still be present in the resulting array.

Account API

Function Returns Description
$account_request = new WorkFlowyAccount($session_id); WorkFlowyAccount Gets an account object
$account_request->getUsername(); string Gets his username
$account_request->getEmail(); string Gets his email address
$account_request->getTheme(); string Gets his selected theme
$account_request->getItemsCreatedInMonth(); int Gets the number of items created during the month
$account_request->getMonthlyQuota(); int Gets his monthly quota
$account_request->getRegistrationDate('d-m-Y'); string Gets his registration date
Leave the format empty to use the default value ('Y-m-d H:i:s')
$account_request->getRegistrationDate('timestamp'); string Gets his registration time

Changelog

Version Date Notes
0.2.3 2019-05-17 Fix authentication process (#10)
0.2.2 2019-02-13 Fix authentication process (#8)
0.2.1 2018-11-11 Fix getLastModifiedTime() and getCompletedTime() methods
Internal WorkFlowy API started returning timestamps in seconds
0.2.0 2018-07-21 Fix getItemsCreatedInMmonth() method naming (renamed to getItemsCreatedInMonth())
Update documentation
Update sample code
0.1.3 2017-02-28 Add $list->getCompletedTime() & $list->getLastModifiedTime() methods (#5)
Fix OPML encoding (#4)
0.1.2 2016-06-26 Fix searchSublistwith get_all option (@hirechrismeyers)
0.1.1 2015-08-25 Fix case of filenames (@citywill)
0.1 2015-01-01 Initial version

License

This project is released under the MIT License.

Credits

More Repositories

1

jpeg-autorotate

πŸ“Έ Node module to rotate JPEG images based on EXIF orientation.
JavaScript
164
star
2

pawnee

πŸͺΆ An Apache GUI for OSX.
JavaScript
94
star
3

three-maze

β™ŸοΈ Creation of random 3D mazes with three.js and tween.js.
JavaScript
48
star
4

elastic-columns

✨ A jQuery plugin designed to be used as an alternative to the well-known Isotope library.
JavaScript
38
star
5

obsidian-automatic-table-of-contents

πŸ’  An Obsidian plugin to create a table of contents in a note, that updates itself when the note changes
JavaScript
36
star
6

vuplicity

πŸ–₯️ A cross-platform GUI for Duplicity backups, powered by Atom Electron.
JavaScript
34
star
7

nwjs-macappstore-builder

🍎 A node module to easily build and publish NW.js apps on the Mac App Store.
JavaScript
28
star
8

nwjs-macappstore

🍎 Publishing NW.js apps on the Mac App Store: a detailed guide
13
star
9

sienna

πŸ–οΈ A Sublime Text 3 theme for macOS.
12
star
10

psi-report

Crawls a website, gets PageSpeed Insights data for each page, and exports an HTML report.
JavaScript
11
star
11

my-sweet-setup

πŸ–±οΈ My sweet setup - OSX tools and tips for web developers and daily users
Shell
9
star
12

webserver

Installation of a basic LAMP server
4
star
13

mac-trash

πŸ—‘οΈ Zero-dependency macOS CLI tool to move files to the Trash
JavaScript
3
star
14

httpdir

πŸ“ Simple, zero dependency command-line HTTP server for static local files
JavaScript
3
star
15

namagic

Batch renaming reloaded for Mac OS X - Built with web technologies
JavaScript
3
star
16

jquery-notready

A lightweight script that allows you to make use of jQuery(document).ready before jQuery loads.
JavaScript
3
star
17

movies

πŸŽ₯ A list of movies I have watched, in a PWA, with ratings and stats
JavaScript
2
star
18

passwordbot

Simple password checker & generator
HTML
2
star
19

awesome-diy

πŸ› οΈ A list of (awesome) DIY content creators
JavaScript
2
star
20

fidget-spinners.net

A big list of nice fidget spinners.
SCSS
2
star
21

git-exporter

A PHP CLI tool designed to export commits from a Git repository.
PHP
1
star
22

withings-fetcher

Basic Withings fetch API written in PHP.
PHP
1
star
23

workadventure-player-sophia-love

Player Sophia office in Workadventure
HTML
1
star
24

music

Display data and export playlists from a Spotify account
JavaScript
1
star
25

standalone-preact-builder

βš›οΈ Build custom, self-contained & self-hosted Preact script in the browser
JavaScript
1
star