GnuCash and PHP

Christian Stimming stimming at tuhh.de
Mon Oct 6 03:37:55 EDT 2008


Quoting Jeremy Andrews <jeremy at tag1consulting.com>:
> 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.

Yes, absolutely. There is an API which consists of everything in the  
src/engine sub-directory including its dependencies (lib/libqof/qof  
and some more). The code in those directories is built into shared  
libraries which intentionally require only the (non-GUI) libglib but  
no libgtk. It's documented by the doxygen source code comments, see  
http://cvs.gnucash.org/docs/HEAD/

> 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.

There has been some work on *python* wrappers to the gnucash API, see  
src/optional/python-bindings and the discussion in this thread  
http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/23800

I don't know how easy it is to access python from PHP, but if it isn't  
too bad, this might be the easiest way for you to start. Of course the  
"best" solution were if you would add PHP wrappers to the SWIG  
definition files, just as they  already both Scheme and Python  
wrappers, but I don't know how hard that would be.

Regards,

Christian



More information about the gnucash-devel mailing list