定制 rindow/phpvenv 二次开发

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

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

rindow/phpvenv

Composer 安装命令:

composer require rindow/phpvenv

包简介

A lightweight virtual environment manager for PHP.

README 文档

README

A lightweight tool to create isolated PHP virtual environments, inspired by Python's venv.

It allows you to create a local environment with its own configuration (php.ini) and local Composer home, without affecting the system-wide PHP installation.

Features

  • Isolated php.ini and configuration directory (conf.d).
  • Environment-specific COMPOSER_HOME.
  • Support for Bash, Zsh, Command Prompt (CMD), and PowerShell.
  • Automatic wrapper scripts to ensure the correct configuration is used.
  • Supports multiple installed PHP versions. The virtual environment automatically uses the same PHP interpreter that was used when running phpvenv.

Installation

You can install this tool globally using Composer:

composer global require rindow/phpvenv

Ensure your global composer bin directory is in your PATH.

Usage

1. Create a new environment

phpvenv myenv

2. Activate the environment

On Unix (Bash/Zsh):

source myenv/bin/activate

On Windows (Command Prompt):

myenv\Scripts\activate.bat

On Windows (PowerShell):

. \myenv\Scripts\Activate.ps1

3. Deactivate

Simply run:

deactivate

4. Multiple PHP Versions

If your system has multiple PHP versions installed, phpvenv can create environments tied to a specific PHP interpreter.

The generated virtual environment stores the path to the PHP executable used during creation (PHP_BINARY) and always uses that interpreter inside the environment.

Example:

php8.2 /installed/dir/phpvenv env82
php8.4 /installed/dir/phpvenv env84

After activation:

source env82/bin/activate
php -v
# PHP 8.2.x

source env84/bin/activate
php -v
# PHP 8.4.x

Note

The environment does not bundle PHP itself. Instead, it creates wrapper scripts that forward execution to the PHP binary used at environment creation time.

License

BSD-3-Clause

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-05-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固