PHPackages                             kreait/gcp-metadata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kreait/gcp-metadata

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kreait/gcp-metadata
===================

Get the metadata from a Google Cloud Platform environment.

1.4.0(2mo ago)654.9M↓47.9%1[2 PRs](https://github.com/beste/gcp-metadata-php/pulls)1MITPHPPHP ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Jul 27Pushed 4d ago3 watchersCompare

[ Source](https://github.com/beste/gcp-metadata-php)[ Packagist](https://packagist.org/packages/kreait/gcp-metadata)[ GitHub Sponsors](https://github.com/sponsors/jeromegamez)[ RSS](/packages/kreait-gcp-metadata/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (8)Dependencies (6)Versions (11)Used By (1)

GCP Metadata
============

[](#gcp-metadata)

> Get the metadata from a Google Cloud Platform environment.

[![Current version](https://camo.githubusercontent.com/8cb6f4c036adec219e35d1df501bd634598febb8843bcbd092cc082b82ca59da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b72656169742f6763702d6d657461646174612e737667)](https://packagist.org/packages/kreait/gcp-metadata)![Supported PHP version](https://camo.githubusercontent.com/a691292af7fbe6eb2886beb1f10ba839861d3a52679f7b484322fa27d22ef85e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b72656169742f6763702d6d657461646174612e737667)[![GitHub license](https://camo.githubusercontent.com/b30296dfd9c18ff4e5ba0af45ea4f08983f9de93dc1be38c1bc17dcd7d55d7b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b72656169742f6763702d6d657461646174612d7068702e737667)](https://github.com/beste/gcp-metadata-php/blob/main/LICENSE)[![Tests](https://github.com/beste/gcp-metadata-php/actions/workflows/tests.yml/badge.svg)](https://github.com/beste/gcp-metadata-php/actions/workflows/tests.yml)[![Sponsor](https://camo.githubusercontent.com/1004a94551d1edaf2a6da4d45ba217b79a46eb18dd7dd2d7825add0a2a8ddc4f/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d476974487562266c6162656c3d53706f6e736f72266d6573736167653d25453225394425413426636f6c6f723d666636396234)](https://github.com/sponsors/jeromegamez)

Important

**Support the project:** If this library saves you or your team time, please consider [sponsoring its development](https://github.com/sponsors/jeromegamez).

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

[](#check-if-the-metadata-server-is-available)

```
$isAvailable = $metadata->isAvailable();
```

#### Get all available instance properties

[](#get-all-available-instance-properties)

```
$data = $metadata->instance();
```

#### Get all available project properties

[](#get-all-available-project-properties)

```
$data = $metadata->project();
```

#### Access a specific property

[](#access-a-specific-property)

```
$data = $metadata->instance('hostname');
```

#### Wrap queries in a try/catch block if you don't check for availability

[](#wrap-queries-in-a-trycatch-block-if-you-dont-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();
}
```

###  Health Score

67

—

FairBetter than 99% of packages

Maintenance94

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~404 days

Recently: every ~449 days

Total

8

Last Release

67d ago

PHP version history (4 changes)1.0PHP ^7.0

1.2.0PHP ^7.2|^8.0

1.3.0PHP ^7.4|^8.0

1.4.0PHP ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8685cf532053a084f1eade7b7da00a512c02676e65f1f1bdec73d4978030a47d?d=identicon)[jeromegamez](/maintainers/jeromegamez)

---

Top Contributors

[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (39 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![iulyanp](https://avatars.githubusercontent.com/u/6533422?v=4)](https://github.com/iulyanp "iulyanp (1 commits)")

---

Tags

gcegcpgooglegoogle-cloudgoogle-cloud-enginegoogle-cloud-platformgooglegoogle cloudgoogle cloud platformgcpgcegoogle-cloud-engine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kreait-gcp-metadata/health.svg)

```
[![Health](https://phpackages.com/badges/kreait-gcp-metadata/health.svg)](https://phpackages.com/packages/kreait-gcp-metadata)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[google/cloud

Google Cloud Client Library

1.2k16.7M57](/packages/google-cloud)[google/auth

Google Auth Library for PHP

1.4k294.2M219](/packages/google-auth)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

346132.9M112](/packages/google-cloud-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
