PHPackages                             kojiro526/cakephp-env - 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. kojiro526/cakephp-env

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

kojiro526/cakephp-env
=====================

Environments plugin for CakePHP

1.0.1(9y ago)0363PHPPHP &gt;=5.5.9

Since Mar 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kojiro526/cakephp-env)[ Packagist](https://packagist.org/packages/kojiro526/cakephp-env)[ RSS](/packages/kojiro526-cakephp-env/feed)WikiDiscussions master Synced 5d ago

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

Environments plugin for CakePHP
===============================

[](#environments-plugin-for-cakephp)

概要
--

[](#概要)

サーバ変数または環境変数で設定した名前に応じて設定ファイルを切り替えるプラグインです。

必要環境
----

[](#必要環境)

- CakePHP 3.x

インストール
------

[](#インストール)

composerで以下のようにインストールします。

```
composer require kojiro526/cakephp-env

```

インストール後、`config/bootstrap.php`に以下を追記します。

```
Plugin::load('Environments', ['bootstrap' => true]);

```

使い方
---

[](#使い方)

`config/`ディレクトリ配下に以下の設定ファイルを配置します。

```
config/
    ┣ environment.php
    ┗ environments/

```

`environment.php`は常に読み込まれます。全ての環境に共通の設定などを記載します。

`environments`ディレクトリ配下に配置したファイルは、名前によって以下のように読み込まれます。

1. `development.php`という名前で作成したファイルは、サーバ変数や環境変数で環境名の設定がされていない場合に読み込まれます。
2. `override.php`という名前で作成したファイルは、上記の`development.php`や下記の環境名で指定された設定ファイルを読み込んだ後に読み込まれます。
    - 各開発担当者がローカル環境上で他のファイルの設定を上書きする用途などで用います。
3. それ以外の名前で作成したファイルは、同一の環境名が設定されている場合に読み込まれます。
    - 例えば、`config/environments/staging.php`というファイルは、サーバ変数や環境変数で`CAKE_ENV=staging`が設定された場合に読み込まれます。

### 環境名の設定

[](#環境名の設定)

環境名は、Webサーバのサーバ変数やOSの環境変数で`CAKE_ENV`という名前で指定します。

#### ローカルサーバを立ち上げる場合

[](#ローカルサーバを立ち上げる場合)

以下のように環境変数を設定して起動します。

Linux、OSX

```
env CAKE_ENV=production ./bin/cake server

```

Windows

```
set CAKE_ENV=production
.\bin\cake server

```

#### Apacheで設定する場合

[](#apacheで設定する場合)

サーバの設定に以下の設定を追記します。

```
SetEnv CAKE_ENV development

```

### 環境名の取得

[](#環境名の取得)

現在の環境名は以下のように取得できます。

```
Configure::read('Environments.env_name')

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~0 days

Total

2

Last Release

3360d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fac9f37d552e34b869374dfa47db163582c91b1c9a6101b6fa6a00a5951c8e99?d=identicon)[kojiro526](/maintainers/kojiro526)

---

Top Contributors

[![tbl-sasaki-t](https://avatars.githubusercontent.com/u/215487691?v=4)](https://github.com/tbl-sasaki-t "tbl-sasaki-t (7 commits)")[![kojiro526](https://avatars.githubusercontent.com/u/2546003?v=4)](https://github.com/kojiro526 "kojiro526 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kojiro526-cakephp-env/health.svg)

```
[![Health](https://phpackages.com/badges/kojiro526-cakephp-env/health.svg)](https://phpackages.com/packages/kojiro526-cakephp-env)
```

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[dereuromark/cakephp-shim

A CakePHP plugin to shim applications between major framework versions.

401.0M11](/packages/dereuromark-cakephp-shim)[cakedc/cakephp-phpstan

CakePHP plugin extension for PHPStan.

40676.6k31](/packages/cakedc-cakephp-phpstan)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)[dereuromark/cakephp-geo

A CakePHP plugin around geocoding tools and helpers.

51174.9k4](/packages/dereuromark-cakephp-geo)

PHPackages © 2026

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