PHPackages                             outcompute/cloudmetadata - 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. outcompute/cloudmetadata

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

outcompute/cloudmetadata
========================

Get metadata JSON within an instance from 169.254.169.254 across providers.

1.5.1(7y ago)126MITPHP

Since Feb 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/outcompute/CloudMetaData)[ Packagist](https://packagist.org/packages/outcompute/cloudmetadata)[ RSS](/packages/outcompute-cloudmetadata/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)DependenciesVersions (6)Used By (0)

CloudMetaData
=============

[](#cloudmetadata)

A simple PHP library to fetch instance meta data from the link local address of  from within an instance.

- Supports [AWS](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html), [Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service), [DigitalOcean](https://developers.digitalocean.com/documentation/metadata/) &amp; [Google Cloud](https://cloud.google.com/compute/docs/storing-retrieving-metadata).
- Results can be cached in a file.
- Always refreshes metadata after a restart.

The 169.254.169.254 is a link-local address and you can read up more about them [here](https://en.wikipedia.org/wiki/Link-local_address).

### Installation

[](#installation)

Add this line to your composer.json file,

```
"outcompute/cloudmetadata": "1.5.0"
```

and run.

```
$ composer update
```

In case you don't want to use composer, you'll have to include all the files, something like this:

```
include_once('src/Cache/AbstractCache.php');
include_once('src/Cache/File.php');
include_once('src/CacheFactory.php');
include_once('src/Provider/AbstractProvider.php');
include_once('src/Provider/AWS.php');
include_once('src/Provider/Azure.php');
include_once('src/Provider/DigitalOcean.php');
include_once('src/Provider/GCP.php');
include_once('src/ProviderFactory.php');
include_once('src/TemplateParser/Base.php');
include_once('src/TemplateParser/AWS.php');
include_once('src/TemplateParser/Azure.php');
include_once('src/TemplateParser/DigitalOcean.php');
include_once('src/TemplateParser/GCP.php');
include_once('src/TemplateParserFactory.php');
include_once('src/MetaData.php');
```

### How to use

[](#how-to-use)

Without cache

```
