Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Bash script for managing locally installed PHP versions using Docker

NotificationsYou must be signed in to change notification settings

mbezhanov/phpvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

phpvm (short for "PHP Version Manager") is a simple bash script for managing PHP versions, inspired byNVM and powered byDocker.

phpvm uses Docker images and containers to enable seamless switching between PHP versions for local development. It can also be used to build highly-customized production-ready PHP Docker images.

Installation

To installphpvm, simply downloadphpvm.sh and put it in your path.

wget https://github.com/mbezhanov/phpvm/archive/master.zipunzip -p master.zip phpvm-master/phpvm.sh> phpvmmv phpvm /usr/local/binchmod +x /usr/local/bin/phpvm

At this point you should be able to callphpvm from your command line.

Quickstart

Simply typingphpvm in your console, without any arguments, will list all of the available commands.

To use a particular PHP version with your project, navigate to your project root, then run:

phpvm use <version>

...where<version> can be any tag available in thePHP Official Docker Image

For example, if you'd like to run PHP 7.3.6, you can do something like:

phpvm use 7.3.6-cli-alpine

This will automatically pull the corresponding image from Docker Hub and start a new container from it, mounting your project root to/src inside the container and installing the latest version of Composer in the process.

You can usephpvm root to open a terminal for interacting with your container as theroot user. This will allow you to tweak the PHP configuration, add specific extensions, or install additional Linux packages.phpvm will remember your changes and associate them with the selected PHP version. Next time you runphpvm use 7.3.6-cli-alpine, you can count on finding the same set of configuration settings, extensions and Linux packages available.

To open a terminal for interacting with your container as the currently logged in user, you can typephpvm tty. This is suitable for runningcomposer install,composer update or any other console scripts and commands related to your project, as it retains the file and directory permissions of your current user.

When you're done using your container, you can optionally typephpvm deactivate to switch it off.

About

Bash script for managing locally installed PHP versions using Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp