Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Support

## Getting Help

- 📖 Read the [documentation](../README.md)
- 💬 Start a [discussion](https://github.com/wp-spaghetti/wp-env/discussions)
- 🐛 Report bugs via [issues](https://github.com/wp-spaghetti/wp-env/issues)

## Community

- Follow [@frugan-dev](https://github.com/frugan-dev) for updates
- Star ⭐ the project if you find it useful

## Commercial Support

For commercial support or consulting: dev@frugan.it
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
assignees:
- "frugan-dev"
commit-message:
prefix: "chore"
prefix: "deps"
include: "scope"
labels:
- "dependencies"
Expand All @@ -27,7 +27,7 @@ updates:
assignees:
- "frugan-dev"
commit-message:
prefix: "chore"
prefix: "ci"
include: "scope"
labels:
- "dependencies"
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- any: ['.github/**']

'area: dependencies':
- any: ['composer.json', 'composer.lock']
- any: ['composer*.json', 'composer*.lock']

'area: config':
- any: ['*.php', '*.json', '*.xml', '*.yml', '*.yaml']
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
extensions: mbstring, intl, :redis
coverage: xdebug

- name: Get composer cache directory
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, intl
extensions: mbstring, intl, :redis

- name: Install dependencies
run: composer install --prefer-dist --no-progress
Expand All @@ -143,7 +143,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, intl
extensions: mbstring, intl, :redis

- name: Install dependencies
run: composer install --prefer-dist --no-progress
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ jobs:
# https://github.com/semantic-release/commit-analyzer/issues/65
# https://github.com/romap0/semantic-release-unsquash/issues/7
extra_plugins: |
@semantic-release/commit-analyzer@latest
@semantic-release/release-notes-generator@latest
@semantic-release/changelog@latest
@semantic-release/git@latest
@semantic-release/github@latest
conventional-changelog-conventionalcommits@latest
env:
# Use the token with bypass permissions
Expand Down
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Cache
.phpunit.cache/
.psalm/
vendor/

# Dependencies
/vendor/
/venv/
composer.lock
composer.develop.*

# OS files
.DS_Store
Thumbs.db

# IDE
.idea/
.vscode/
*.swo
*.swp
*~

# Other
/.claude*
2 changes: 2 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,5 +619,5 @@ See [CONTRIBUTING](.github/CONTRIBUTING.md) for detailed guidelines.

## License

(ɔ) Copyleft 2025 [Frugan](https://frugan.it).
(ɔ) Copyleft 2026 [Frugan](https://frugan.it).
[GNU GPLv3](https://choosealicense.com/licenses/gpl-3.0/), see [LICENSE](LICENSE) file.
159 changes: 80 additions & 79 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,82 +1,83 @@
{
"name": "wp-spaghetti/wp-env",
"description": "A comprehensive WordPress environment management utility with Docker detection, typed getters, and secure configuration handling",
"license": "GPL-3.0-or-later",
"type": "library",
"keywords": [
"wordpress",
"environment",
"configuration",
"docker",
"env",
"config",
"bedrock"
],
"authors": [
{
"name": "Frugan",
"email": "dev@frugan.it",
"homepage": "https://github.com/frugan-dev",
"role": "Developer"
}
],
"homepage": "https://github.com/wp-spaghetti/wp-env",
"support": {
"issues": "https://github.com/wp-spaghetti/wp-env/issues",
"source": "https://github.com/wp-spaghetti/wp-env",
"docs": "https://github.com/wp-spaghetti/wp-env#readme"
},
"funding": [
{
"type": "custom",
"url": "https://buymeacoff.ee/frugan"
}
],
"require": {
"php": ">=8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.86",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpro/grumphp-shim": "^2.0",
"phpstan/phpstan": "^1.12|^2.1",
"phpunit/phpunit": "^9.0|^10.0|^11.0|^12.0",
"povils/phpmnd": "^3.6",
"rector/rector": "^1.2|^2.1",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.13 || ^4.0",
"vimeo/psalm": "^5.26|^6.13"
},
"suggest": {
"oscarotero/env": "For .env file support in modern WordPress setups like Bedrock"
},
"autoload": {
"psr-4": {
"WpSpaghetti\\WpEnv\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WpSpaghetti\\WpEnv\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"phpro/grumphp-shim": true
},
"optimize-autoloader": true,
"sort-packages": true
},
"scripts": {
"analysis": "@check --tasks=phpstan",
"check": "@php -d max_execution_time=0 -d memory_limit=-1 -f ./vendor/bin/grumphp -- run",
"ci": "@check --no-interaction",
"lint": "@check --tasks=phpcsfixer,phplint,rector",
"quality": "@check --tasks=phpmnd,phpparser",
"rector": "@php -d max_execution_time=0 -d memory_limit=-1 -f ./vendor/bin/rector -- process --ansi --clear-cache",
"security": "@check --tasks=securitychecker_roave",
"test": "@check --tasks=phpunit",
"test:coverage": "@php -d max_execution_time=0 -d memory_limit=-1 ./vendor/bin/phpunit --coverage-clover=coverage.xml"
"name": "wp-spaghetti/wp-env",
"description": "A comprehensive WordPress environment management utility with Docker detection, typed getters, and secure configuration handling",
"license": "GPL-3.0-or-later",
"type": "library",
"keywords": [
"wordpress",
"environment",
"configuration",
"docker",
"env",
"config",
"bedrock"
],
"authors": [
{
"name": "Frugan",
"email": "dev@frugan.it",
"homepage": "https://github.com/frugan-dev",
"role": "Developer"
}
],
"homepage": "https://github.com/wp-spaghetti/wp-env",
"support": {
"issues": "https://github.com/wp-spaghetti/wp-env/issues",
"source": "https://github.com/wp-spaghetti/wp-env",
"docs": "https://github.com/wp-spaghetti/wp-env#readme"
},
"funding": [
{
"type": "custom",
"url": "https://buymeacoff.ee/frugan"
}
],
"require": {
"php": ">=8.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.50",
"friendsofphp/php-cs-fixer": "^3.86",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpro/grumphp-shim": "^2.0",
"phpstan/phpstan": "^1.12 || ^2.1",
"phpunit/phpunit": "^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
"povils/phpmnd": "^3.6",
"rector/rector": "^1.2 || ^2.1",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.13 || ^4.0",
"vimeo/psalm": "^5.26 || ^6.13"
},
"suggest": {
"oscarotero/env": "For .env file support in modern WordPress setups like Bedrock"
},
"autoload": {
"psr-4": {
"WpSpaghetti\\WpEnv\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WpSpaghetti\\WpEnv\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"phpro/grumphp-shim": true
},
"optimize-autoloader": true,
"sort-packages": true
},
"scripts": {
"analysis": "@grumphp --tasks=phpstan",
"ci": "@grumphp --no-interaction",
"grumphp": "@php -d max_execution_time=0 -d memory_limit=-1 -f ./vendor/bin/grumphp -- run",
"lint": "@grumphp --tasks=phpcsfixer,phplint,rector",
"quality": "@grumphp --tasks=phpmnd,phpparser",
"rector": "@php -d max_execution_time=0 -d memory_limit=-1 -f ./vendor/bin/rector -- process --ansi --clear-cache",
"security": "@grumphp --tasks=securitychecker_roave",
"test": "@grumphp --tasks=phpunit",
"test:coverage": "@php -d max_execution_time=0 -d memory_limit=-1 ./vendor/bin/phpunit --coverage-clover=coverage.xml"
}
}
3 changes: 1 addition & 2 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ grumphp:
composer: ~

# Composer normalize - standardize composer.json format
#FIXME - Temporarily disabled for PHP 8.4 compatibility
#composer_normalize: ~
composer_normalize: ~

# File size check - prevent overly large files
file_size:
Expand Down
4 changes: 4 additions & 0 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public static function getBool(string $key, bool $default = false): bool
if (\is_string($value)) {
$value = strtolower(trim($value));

if ('' === $value) {
return $default;
}

return \in_array($value, ['1', 'true', 'on', 'yes', 'enabled'], true);
}

Expand Down
5 changes: 5 additions & 0 deletions tests/EnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public function testBasicGet(): void

public function testGetBool(): void
{
// Test empty string falls back to default
set_mock_env_var('EMPTY_BOOL_TEST', '');
self::assertTrue(Environment::getBool('EMPTY_BOOL_TEST', true));
self::assertFalse(Environment::getBool('EMPTY_BOOL_TEST', false));

// Test various truthy values
set_mock_constant('BOOL_TRUE_TEST', true);
set_mock_constant('STRING_TRUE_TEST', 'true');
Expand Down
Loading