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.3.2(3y ago)664.8M—6.6%11MITPHPPHP ^7.4|^8.0CI passing

Since Jul 27Pushed 3mo ago3 watchersCompare

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

READMEChangelog (7)Dependencies (3)Versions (8)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

54

—

FairBetter than 97% of packages

Maintenance55

Moderate activity, may be stable

Popularity53

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 91.4% 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 ~237 days

Recently: every ~205 days

Total

7

Last Release

1427d ago

PHP version history (3 changes)1.0PHP ^7.0

1.2.0PHP ^7.2|^8.0

1.3.0PHP ^7.4|^8.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 (32 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

[google/cloud

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[google/cloud-core

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

343121.4M79](/packages/google-cloud-core)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[nelexa/google-play-scraper

Scrapes app data from Google Play store.

88487.4k](/packages/nelexa-google-play-scraper)

PHPackages © 2026

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