To me, it seems that you do not need to deal directly with Protobuf files because you already have the data in your database. So someone else already take care of reading the information.
The data structure of GTFS-realtime is Protobuf Protocol and you need to know exactly how it works. Here is an outline of the typical process of reading Protobuf data. These instructions do not work for PHP but it give you the general idea of the process.
- First you need to install Protobuf compiler. If you are using Mac OS X, read this.
- Use
protoc
command to generate the protocol buffer API for your GTFS-realtime data. The command line only supports C++, Java, and Python.
- You can use this API to read your data.
As far as I understand the repo that you linked to, is only for GTFS-realtime data, so the protocol buffer API is already created. The only thing that you need to do is to use the code snippet that provided in the page:
require_once 'vendor/autoload.php';
use transit_realtime\FeedMessage;
$data = file_get_contents("URL OF YOUR GTFS-REALTIME SOURCE GOES HERE");
$feed = new FeedMessage();
$feed->parse($data);
foreach ($feed->getEntityList() as $entity) {
if ($entity->hasTripUpdate()) {
error_log("trip: " . $entity->getId());
}
}
Conclusion:
GTFS-realtime is special kind of data in Protobuf protocol that handle transit information. You can create a Protobuf API to read the data from the Protobuf files. But if you already have them in your database, there is not much left to do.