fragly/laravel-envsync
Composer 安装命令:
composer require fragly/laravel-envsync
包简介
A Laravel package that compares and syncs your .env with .env.example for safer CI/CD environments.
README 文档
README
Compare and safely synchronize your
.envwith.env.example.
Perfect for CI/CD pipelines, team development, and clean environments.
Contents
- Features
- Installation
- Usage
- Example workflow (CI/CD)
- Configuration
- Local development (testing the package)
- About the Author
- License
🚀 Features
✅ Compares .env.example ↔ .env
✅ Shows missing, extra, and same-as-default variables
✅ Auto-syncs .env with .env.example
✅ Makes safe backups before changes
✅ Ignores keys or patterns (APP_KEY, LOG_*, etc.)
✅ Perfect for automation (non-interactive mode for CI)
🧩 Installation
composer require fragly/laravel-envsync --dev
The serviceprovider is auto-discovered by Laravel.
🧠 Usage
🔍 Compare
php artisan env:diff
Example output:
> Checking .env consistency
! Missing in .env:
+ MAIL_ENCRYPTION
+ REDIS_PASSWORD
>> Extra in .env:
+ OLD_DEBUG_FLAG
!! Same-as-default values (check you configured them):
+ APP_NAME
+ APP_ENV
+ APP_DEBUG
Summary: missing=2, extra=1, same-as-default=3
JSON output (for CI)
php artisan env:diff --json
Filter or hide sections
php artisan env:diff --only=missing php artisan env:diff --hide-defaults php artisan env:diff --ignore=APP_KEY,LOG_*,REDIS_*
🔄 Sync
Synchronize .env with .env.example.
php artisan env:sync
Options
| Option | Description |
|---|---|
--empty |
Add missing variables with empty values instead of defaults |
--prune |
Remove keys not present in .env.example |
--no-backup |
Skip creating .env.bak.* backup |
--yes |
Non-interactive (for CI/CD) |
--json |
Output result in JSON |
--ignore= |
Comma-separated ignore list (same syntax as env:diff) |
Example
php artisan env:sync --prune --yes --ignore=APP_KEY,LOG_*
🧰 Example workflow (CI/CD)
In your pipeline:
composer install php artisan env:sync --yes --prune php artisan config:cache
Keeps environment variables always in sync automatically
⚙️ Configuration
You can create .envsyncignore file in the project root to store patterns ignored in both commands:
APP_KEY
LOG_*
MAIL_*
REDIS_*
🧪 Local development (testing the package)
If you want to test this package locally without publishing to Packagist:
// in your project's composer.json { "repositories": [ { "type": "path", "url": "../package-destination" } ] }
Then install it:
composer require fragly/laravel-envsync:@dev
Composer will symlink your package for instant updates.
🧑💻 About the Author
Fragly Dev — Building tools for modern Laravel & Next.js developers. Follow for more developer utilities, security helpers, and SaaS-ready boilerplates.
📜 License
This package is open-sourced software licensed under the MIT license.
🔍 SEO Keywords
laravel env sync, laravel .env compare, laravel .env validator, laravel .env example check,
laravel environment sync, laravel environment tool, laravel environment manager,
laravel ci cd tools, laravel devops utilities, laravel config checker,
laravel configuration sync, laravel dotenv helper, laravel dotenv checker,
laravel deployment tools, laravel config diff, laravel config audit,
laravel .env fixer, laravel production best practices,
laravel environment consistency, laravel config manager, laravel dotenv sync,
laravel automation tools, laravel artisan env command, fragly env sync, fragly laravel package
fragly/laravel-envsync 适用场景与选型建议
fragly/laravel-envsync 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「configuration」 「sync」 「laravel」 「environment」 「env」 「dotenv」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fragly/laravel-envsync 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fragly/laravel-envsync 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fragly/laravel-envsync 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Configuration component
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
Sync content to other sites on element save.
Utils to load, parse and work with configuration on Mezzio projects
Production-ready third-party integrations for Laravel. Credential management, API request logging, rate limiting, sync scheduling, OAuth2, and health monitoring.
Synchronizing data between Laravel's framework
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-25