kreait/gcp-metadata
Composer 安装命令:
composer require kreait/gcp-metadata
包简介
Get the metadata from a Google Cloud Platform environment.
README 文档
README
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-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(); }
统计信息
- 总下载量: 4.92M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 65
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-27