PHPackages                             razorpay/ec2-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. razorpay/ec2-metadata

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

razorpay/ec2-metadata
=====================

This tool is a rewrite of the EC2 Instance Metadata API for PHP.

3.0.0(3y ago)7146.3k↑86.7%1[3 PRs](https://github.com/razorpay/ec2-metadata/pulls)1MITPHPPHP ^8.1CI passing

Since Dec 3Pushed 9mo ago62 watchersCompare

[ Source](https://github.com/razorpay/ec2-metadata)[ Packagist](https://packagist.org/packages/razorpay/ec2-metadata)[ RSS](/packages/razorpay-ec2-metadata/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (22)Used By (1)

ec2-metadata [![Build Status](https://camo.githubusercontent.com/9486dec3262ae5be8eba4f9eb187746934885e5c509f4322ad89b95a790cbed3/68747470733a2f2f7472617669732d63692e6f72672f72617a6f727061792f6563322d6d657461646174612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/razorpay/ec2-metadata)
===========================================================================================================================================================================================================================================================================================================

[](#ec2-metadata-)

This tool is a rewrite of the [EC2 Instance Metadata API](http://aws.amazon.com/code/1825) for PHP.

This is a fork of [d9magai/Ec2MetadataGetter](https://github.com/d9magai/Ec2MetadataGetter).

The differences from the fork are:

- An additional method called `getMultiple` which fetches multiple instance attributes specified in an array
- Caching support. The same request repeated twice on the same machine will give a cached response.
- Custom caching directory. The constructor now takes a cache storage directory and uses that.
- Support for returning dummy data

### Usage:

[](#usage)

In composer.json

```
"require": {
	"razorpay/ec2-metadata": "dev-master"
}
```

In your code:

```
