GnuCash and PHP

Jeremy Andrews jeremy at
Sun Oct 5 20:00:51 EDT 2008


I'm exploring the possibility of accessing some GnuCash data through a
PHP application.  The short term goal would be the ability to browse
financial information through a web browser.  While a long time user of
GnuCash, I've never explored it at the code level before.  I spent some
time this afternoon poking around, and have a few general questions.

Is there a library and/or API making it possible for external programs
to access GnuCash data?  I'd prefer accessing through an API, rather
than parsing the XML data files directly, or even directly accessing the
new SQL back-end.

Specifically, my goal is to work on a PHP extension.  The first function
I would be interested in would be to retrieve the accounts tree.  The
API of this PHP function is not particularly important at this time,
though my thought would be that I would specify a depth, and a parent
(NULL parent if depth is 0).  Ideally, this would return the same
information that is found in the Accounts tab: Account Name,
Description, and Total.

Later functions would continue to expose additional information via the
PHP extension.  I would personally use this PHP extension to write a
module for the Drupal CMS, making certain accounting information
available online.

Down the road, it could be useful to provide PHP functions for updating
information, not just viewing it.  But this is beyond what I need now,
and not what I wish to focus on in the present.

Can anyone point me in the right direction for getting started?  How can
I programmatically access the necessary GnuCash data from an external
program?  Or is there a better way to achieve my goals that I'm not


More information about the gnucash-devel mailing list