PHPackages                             horat1us/yii2-header-environment - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. horat1us/yii2-header-environment

ActiveLibrary[Testing &amp; Quality](/categories/testing)

horat1us/yii2-header-environment
================================

Loading environment variables from HTTP Headers (for testing purposes)

1.0.1(8y ago)052MITPHPPHP &gt;=7.1

Since Apr 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Horat1us/yii2-header-environment)[ Packagist](https://packagist.org/packages/horat1us/yii2-header-environment)[ RSS](/packages/horat1us-yii2-header-environment/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (3)Used By (0)

Yii2 Header Behavior
====================

[](#yii2-header-behavior)

[![Latest Stable Version](https://camo.githubusercontent.com/21b75e58df997015792743e4c676206a9200682f0e2213531b6cb0d93a6369f6/68747470733a2f2f706f7365722e707567782e6f72672f686f7261743175732f796969322d6865616465722d656e7669726f6e6d656e742f762f737461626c652e706e67)](https://packagist.org/packages/horat1us/yii2-header-environment)[![Total Downloads](https://camo.githubusercontent.com/62611de7c3439fe47e9156f91350a81bc5198a764832556ed83fdc4a4d97c141/68747470733a2f2f706f7365722e707567782e6f72672f686f7261743175732f796969322d6865616465722d656e7669726f6e6d656e742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/horat1us/yii2-header-environment)[![Build Status](https://camo.githubusercontent.com/e44275451cb384c2c62bee897647f04a75374cc300419857f5a4c92bd77d6bd2/68747470733a2f2f7472617669732d63692e6f72672f486f7261743175732f796969322d6865616465722d656e7669726f6e6d656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/horat1us/yii2-header-environment)[![codecov](https://camo.githubusercontent.com/d44f717e7a02526986ca9849af5a6a48a84fee7987eb8e687b0fc9300d01e071/68747470733a2f2f636f6465636f762e696f2f67682f686f7261743175732f796969322d6865616465722d656e7669726f6e6d656e742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/horat1us/yii2-header-environment)

Purpose of this package is to load environment variables from HTTP headers.
Case: your API receives hash and need to check it by secret key stored in environment. Your test case can not directly use `putenv` because API and Test API Client is executed in different flows.

**Notice: you should use this package only in test environment!**

Installation
------------

[](#installation)

```
composer require horat1us/yii2-header-environment --dev # Don't forget to do not use it in production
```

Usage
-----

[](#usage)

Controller:

```
