Get the metadata from a Google Cloud Platform environment.
Important
Support the project: If this library saves you or your team time, please consider sponsoring its development.
Note
The project moved from the kreait to the beste GitHub Organization in January 2026.
The namespace remains Kreait\Laravel\Firebase and the package name remains kreait/laravel-firebase.
Please update your remote URL if you have forked or cloned the repository.
$ composer install kreait/gcp-metadatause Kreait\GcpMetadata;
$metadata = new GcpMetadata();$isAvailable = $metadata->isAvailable();$data = $metadata->instance();$data = $metadata->project();$data = $metadata->instance('hostname');use Kreait\GcpMetadata;
$metadata = new GcpMetadata();
if ($metadata->isAvailable()) {
echo $metadata->instance('hostname');
}
try {
echo $metadata->instance('hostname');
} catch (GcpMetadata\Error $e) {
echo $e->getMessage();
}