Question: I have a GTFS protocol buffer message (VehiclePosition.pb), and the corresponding protocol format (gtfs-realtime.proto), I would like to read the message in PHP alone (is that even possible?).

I looked at Google's python tutorial <https://developers.google.com/protocol-buffers/docs/pythontutorial> and encoding documentation <https://developers.google.com/protocol-buffers/docs/encoding> and <https://github.com/maxious/ACTBus-ui/tree/master/lib/Protobuf-PHP>, but I am having a really hard time conceptualizing what is going on. I think I understand that gtfs-realtime.php is a compiled instruction set of the encoding defined in gtfs-realtime.proto (please correct me if I am wrong), but I have no clue how to get it to decode VehiclePosition.pb. Also, what are the dependencies of gtfs-realtime.php (or the python equivalent for that matter)? Is there anything else I have to compile myself or anything that is not a simple php script if all I want to do is read VehiclePosition.pb?

Thanks.

Answer: 
You can use the official tool: <https://developers.google.com/transit/gtfs-realtime/code-samples#php>

It was released very recently. I've been using it for a few days and works like a charm.
I would assume something along the lines of this snippet:

```
<?php
require_once 'DrSlump\Protobuf.php';

use DrSlump\Protobuf;

$data = file_get_contents('data.pb');
$person = new Tutorial\Person($data);
echo $person->getName();

```

as taken from the man page: <http://drslump.github.io/Protobuf-PHP/protobuf-php.3.html>

Before that step, I think you need to generate your PHP classes using the CLI tool as described here: <http://drslump.github.io/Protobuf-PHP/protoc-gen-php.1.html>

so something along the lines of:

```
protoc-gen-php gtfs-realtime.proto

```