定制 tamer-dev/laravel-env-cli 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tamer-dev/laravel-env-cli

Composer 安装命令:

composer require tamer-dev/laravel-env-cli

包简介

laravel commands to work with .env file in cli

README 文档

README

Latest Version on Packagist Total Downloads License

This Laravel package offers to you some commands to work with your env file from the command line. if you are making changes frequently to your env file this package will help you to do this fast and in an effective way.

This package supports the Laravel version from 5.7 to 10 .

Installation

You can install this package with Composer using the following command:

composer require tamer-dev/laravel-env-cli

Usage

1- Set Environment Variable Command

command definition :- env:set {key} {value}

this command by default will use .env file

optional command options:- {--file=your-custom-env-name} if you want to set a key in custom env file

{--b|backup} take a backup from env file before set the key

you must provide both a key and value .

$ php artisan env:set app_name Example
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'

you can provide them as two arguments as commnd before or one argument like follwoing:- .

$ php artisan env:set app_name=Example
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'

if you value have spaces you can wrapping them in quotes like follwoing:-.

$ php artisan env:set app_name "Example App"
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to '"Example App"'

you can create new environment variables if this key dose not exist.

$ php artisan env:set editor=vscode
# Environment variable with key 'EDITOR' has been set to 'vscode'

you can create or update environment variables in another file not in the default one by passing --file option like following:-

$ php artisan env:set app_name Example --file=.env.example
# Environment variable with key 'EDITOR' has been set to 'vscode'

also you can take a backup file from your env file before make any changes in same command by passing -b option (a new file backup with the name '.env.backup_<current_date_time>' will be created) like following:-

$ php artisan env:set app_name Example -b
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'

another features :-

  • update an empty value
  • stop invalid inputs
  • stop updateing in APP_KEY

2- Read Environment Variable Command

command definition :- env:read {key} this command by default will use .env file

$ php artisan env:read app_name 
# Environment variable with key [APP_NAME] have value [Laravel] file used is .env

optional command options:- {--file=your-custom-env-name} if you want to read a key from a custom env file

$ php artisan env:read app_name --file=.env.example
#Environment variable with key [APP_NAME] have value [tamertest3] file used is .env.example

3- Backup Environment File Command

this command will make a backup from env file (a new file backup with the name '.env.backup_<current_date_time>' will be created)

command definition :- env:backup this command by default will use .env file

$ php artisan env:backup 
#new environment backup file has been created in this path '/var/www/html/laravel-env-cli/.env.backup_20200517204848'

optional command options:- {--file=your-custom-env-name} if you want to backup a custom env file

$ php artisan env:backup --file=.env.example
#new environment backup file has been created in this path '/var/www/html/laravel-env-cli/.env.example.backup_20200517205000'

4- Restore Environment File Command

restore your .env file from a backup file

command definition :- env:restore {backupedFileName} this command by default will use .env file

$ php artisan env:restore .env.backup_20200517204848
#the env file '/var/www/html/laravel-env-cli/.env' 
#has been restored from this file path '/var/www/html/laravel-env-cli/.env.backup_20200517204848'

optional command options:- {--file=your-custom-env-name} if you want to restore a custom env file

$ php artisan env:restore .env.backup_20200517204848 --file=.env.example
#the env file '/var/www/html/laravel-env-cli/.env.example' 
#has been restored from this file path '/var/www/html/laravel-env-cli/.env.backup_20200517204848'

The MIT License (MIT). Please see License File for more information.

Contribution

contribution are welcome ,if any one want to contribute in this package you can start by picking from this list : -

  • add tests
  • add more commands and important features
  • fix any issues

Notes

this package inspired by this package imliam/laravel-env-set-command,for that all thanks to imliam

License

The MIT License (MIT). Please see License File for more information.

tamer-dev/laravel-env-cli 适用场景与选型建议

tamer-dev/laravel-env-cli 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.51k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2020 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「environment」 「artisan」 「env」 「variables」 「laravel-env-set」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 tamer-dev/laravel-env-cli 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tamer-dev/laravel-env-cli 我们能提供哪些服务?
定制开发 / 二次开发

基于 tamer-dev/laravel-env-cli 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7.51k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-14