kreait/gcp-metadata
Get the metadata from a Google Cloud Platform environment.
Maintainers
Fund package maintenance!
Requires
- php: ~8.3.0 || ~8.4.0 || ~8.5.0
- guzzlehttp/guzzle: ^7.10.0
- psr/http-message: ^1.0 || ^2.0
Requires (Dev)
- phpunit/phpunit: ^12.5.23
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 427315fa21285496017678ce8f0112171bb10912
- JΓ©rΓ΄me Gamez <jerome.woop@gamez.name>
googlegcpgcegoogle-cloudgoogle-cloud-enginegoogle-cloud-platform
README
Get the metadata from a Google Cloud Platform environment.
π Current version
π Supported PHP version
π GitHub license
π Tests
π Sponsor
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-metadata
use Kreait\GcpMetadata; $metadata = new GcpMetadata();
Check if the metadata server is available
$isAvailable = $metadata->isAvailable();
Get all available instance properties
$data = $metadata->instance();
Get all available project properties
$data = $metadata->project();
Access a specific property
$data = $metadata->instance('hostname');
Wrap queries in a try/catch block if you don't check for availability
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(); }
