Announcing the PHP GBIF library

The Musa in situ project, led jointly by CIRAD and Bioversity, collects data on Musaceae around the world, in the wild or in the closest to natural growing conditions. The main purpose is to obtain an as precise as possible picture of the natural geographical diversity of Musaceae. Although it initially relied on an iNaturalist project, it now integrates other sources of data, particularly GBIF, which provides a REST interface.

GBIF also provides an access through a web interface which internally consumes this REST service. However, for the Musa in situ project, it was best to request these data directly from our site—ideally with a view, so that we could select which data should be imported into the local database, and so that we were able to ensure coherence with what had already been imported, or what we refrain from importing.

As it happens, a reference implementation is available for the R language, namely rgbif. This client is an abstraction allowing to interrogate the GBIF database without the need to delve into web services requests. It was ported (more or less comprehensively) to Python (pygbif) and Ruby (gbifrb). From now on, we can also count on PHP GBIF, developed as part of the Musa in situ project. Our hope is that this free (GPLv3) project may be useful to other individuals and entities who wish to interact with this central repository of biodiversity worldwide.

Installing is as simple as a composer require restelae/php-gbif. This library requires PHP version 7.2 or later. All the necessary usage information can be found on its homepage as well as the documentation automatically generated with Doxygen.

We also wrote a module for Drupal (currently Drupal 7) which relies on this library and allows to display occurrences from GBIF with Views, only in site building, with web service calls, without interrogating the local database! Coupled with the Views Bulk Operations module, you may use it to process GBIF occurrences on your website, e.g. importing them locally with the Migrate module.

Currently, the PHP GBIF project only supports occurrences (search and retrieval) and species. We are looking for sponsors and contributors to implement the whole API, and thus greatly facilitate access to GBIF data to all projects written in PHP. Do not hesitate to get in touch in case you are interested!

1 Like

Hi, thanks for sharing! It’s always great to see novel ways of getting to GBIF data.

Have you considered how users of the library can cite the records they retrieve? As you may know the terms of use for GBIF data requires that users publicly acknowledge the Data Publishers whose biodiversity data they have used. I think it’s important that tools and libraries accessing GBIF help users in this process.

I see rgbif has such a tool, whereas pygbif does not look like it has one. We may consider it at some point depending on the level of adoption of this project.

I think the most important thing is to ensure that users are made aware of the terms of the user agreement and that occurrences relayed to the user are accompanied with relevant provenance information, in particular the parent dataset (including it’s identifier).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.