• Stars
    star
    679
  • Rank 66,532 (Top 2 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 13 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

stupid simple PHP version management

simple PHP version switching

php-version exposes a php-version command allowing developers to switch between versions of PHP.

This IS for you if

  • You are not satisifed with heavy handed *AMP or PPA-based installers.
  • You use multiple versions of PHP on Linux or Mac.
  • You download pre-compiled PHP binaries for Windows (NOTE: this is a bash script so you'll need WSL).
  • You want to run your automated tests against multiple PHP versions.
  • You are a developer that works on a variety of PHP projects each requiring different versions of PHP.
  • You want to work on the latest PHP, but expect to support prior work that was done on older PHP versions.

This is NOT for you if

  • You are content with heavy handed *AMP installers.
  • You are provisioning a production server so you only need a single PHP install.
  • You NEVER work on more than one PHP project at a time.
  • You don't plan on supporting prior work that was done on other PHP versions.

Rationale

php-version attempts to stick to the classic UNIX notion that tools should do one thing well.

While there are smart alternative tools that attempt to solve this problem, none of the tools I've found were simple enough for me.

Features

  • Homebrew installed PHP versions are picked up automatically.
  • PHP versions installed into ~/.phps are picked up automatically.
  • PHP versions listed in the $PHP_VERSIONS shell variable are picked up automatically.
  • snap versioning: Use a partial version number (i.e. php-version 5) to automatically use the latest 5.x version.
  • per version php.ini: we export PHPRC if a version-specific php.ini exists.
  • configurable: php-version --help for details.
  • bash, zsh, and fish shells actively supported; though care has been taken such that other shells are likely to work as well.
  • tiny: less than 200 LOC; a single function sourced via your shell's initialization file.

Non-Features

  • no shims, sub-shells, symlinks or cd hooks.
  • we won't leave files and symlinks all over the place.
  • does not attempt to manage Apache, MySQL, etc.
  • does not attempt to compile, build, or install PHP.
  • does not attempt to support OS package manager installed (i.e. ppa, etc.) PHP versions.

Usage Examples

Switch to a specific PHP version

% php-version <version>

List installed and active (*) PHP version(s)

% php-version
  5.3.9
  5.3.10
  5.4.0RC8
  5.4.0RC6
  5.4.0
* 5.4.8

Install

homebrew (recommended for OSX users)

% brew tap wilmoore/formulae
% brew install php-version

cURL (for non-OSX users or those that prefer not to use homebrew):

% mkdir -p $HOME/local/php-version # or your place of choice
% cd !$
% curl -# -L https://github.com/wilmoore/php-version/tarball/master | tar -xz --strip 1

Alternative (i.e. non-Homebrew) installation methods are documented on the wiki.

Setup

Add one of the following to your shell's initialization file:

# Homebrew (recommended)
source $(brew --prefix php-version)/php-version.sh
php-version 5

# non-Homebrew
source $HOME/local/php-version/php-version.sh # or your place of choice
php-version 5

Type php-version --help for more configuration options such as how to add extra PHP installation paths or php-config --version to find out which php version is active.

If you have PHP versions in multiple directories, you can list them in the environment variable PHP_VERSIONS separated by spaces as depicted below:

export PHP_VERSIONS="$HOME/local/php $HOME/php/versions"

NOTE: do this before you source php-version.sh:

Deactivate / Uninstall

  1. Remove setup configuration.

  2. Enter one of the following commands listed below to remove associated files.

     # Homebrew (recommended)
     % brew remove --force php-version
    
     # non-Homebrew
     % rm -rf $HOME/local/php-version
    

Having Issues?

  1. Copy the bug report output to your clipboard (pbcopy works on Mac OSX; use your OS equivalent)

     % cd /tmp
     % git clone https://github.com/wilmoore/php-version.git
     % source php-version/bug-report.sh | pbcopy
    
  2. File an issue.

More Info

Contributors

https://github.com/wilmoore/php-version/graphs/contributors

Alternatives

Inspiration

LICENSE

MIT

More Repositories

1

frontend-packagers

Front-End Package Manager Comparison
442
star
2

selectn.js

Curried property accessor function that resolves deeply-nested object properties via dot/bracket-notation string path while mitigating TypeErrors via friendly and composable API.
JavaScript
193
star
3

require-grunt-configs

Load a directory of grunt configurations.
JavaScript
45
star
4

attributes.php

A minimal trait to decrease getter/setter boilerplate.
PHP
22
star
5

node-supertest-koa-agent

Converts a Koa app into a supertest compatible agent instance.
JavaScript
15
star
6

request-id.js

Allows you to identify client requests within non-sequential logs such as Syslog by adding a response header of X-Request-Id. Allows setting value via query parameter or request header. For Koa and Express.
JavaScript
14
star
7

homebrew-home

An alternative Homebrew installation script that eliminates annoying `brew doctor` notices by putting Homebrew into `~/.homebrew` instead of `/usr/local`.
13
star
8

node-homedir

Platform agnostic user home directory path resolution for Node.js.
JavaScript
10
star
9

ruby-version

stupid simple RUBY version management
Shell
10
star
10

basic-auth-token.js

Token generated by concatenating username and password with : character within a base64 encoded string.
JavaScript
7
star
11

to-array.js

Converts primitives and objects (plain or array-like) to a sensible array representation for Node.js and the browser.
JavaScript
7
star
12

browserify-standalone

Browserify standalone (UMD) build based on values in your package.json (name and main).
JavaScript
5
star
13

sprout-commonjs-lib

Sprout based Node/CommonJS package generator.
JavaScript
5
star
14

filemanager-php-s3-plugin

Core Five FileManager PHP connector S3 plugin
PHP
5
star
15

macbook

Mac OS X setup for software developers.
5
star
16

mocha-chai-coffee

Minimal Node.js module example with production code written in pure JavaScript and unit tests written in CoffeeScript. Tests written against the Mocha and Chai libraries. Continuous integration via Travis.
CoffeeScript
5
star
17

nodejs-install

Installs pre-compiled NodeJS binaries while avoiding sudo or chown.
Shell
5
star
18

mocha-chai-livescript

Minimal Node.js module example with production code written in pure JavaScript and unit tests written in LiveScript. Tests written against the Mocha and Chai libraries. Continuous integration via Travis.
LiveScript
5
star
19

git-hub

Git extension for automating your github.com (or enterprise) workflow from the command-line.
Shell
4
star
20

brackets2dots.js

Convert string with bracket notation to dot property notation for Node.js and the browser.
JavaScript
4
star
21

sinon-browser-only

SinonJS browser build.
JavaScript
4
star
22

array-groupby.js

Curried function that returns a map (object) with keys derived by applying each array element to the given identity function. The value(s) at each key will be an array of elements whose identity matches the given key.
JavaScript
4
star
23

ontap

Declare and install homebrew formulae and taps via ~/.ontaprc (deprecated in favor of brew bundle and brew bundle-dir)
Shell
4
star
24

node-env-newrelic

Load newrelic in a 12-factor environment with sane defaults.
JavaScript
4
star
25

uuid-regexp.js

RegExp for finding an RFC4122 compliant UUID in a string.
JavaScript
4
star
26

rerun-script

Via package.json, configure glob patterns to watch and invoke an npm run script on change.
JavaScript
3
star
27

node-assert-env

Assert that specific environment variables exist.
JavaScript
3
star
28

basic-authorization-header.js

RFC2617 basic authorization header from username and password.
JavaScript
3
star
29

regexp-map.js

Curried function which takes a map of `RegExp` string keys which when successfully matched given string, resolves to mapped value.
JavaScript
3
star
30

almon

Asterisk Log Monitor
PHP
3
star
31

node-env-accessors

process.env accessor functions.
JavaScript
3
star
32

provision-servers

Minimal server provisioning/deployment via SSH.
Shell
2
star
33

dotsplit.js

Transform dot delimited strings to array of strings for Node.js and the browser.
JavaScript
2
star
34

curry2.js

Curry a binary function.
JavaScript
2
star
35

orderby-time.js

Curried function returning a new array sorted by time without mutating the original array.
JavaScript
2
star
36

react-native-expo-turtle-build-and-upload

A set of GNU Make targets for building and uploading React Native application releases for iOS and Android.
Makefile
2
star
37

active-activity-search.js

Active.com Activity Search v2 HTTP API client.
JavaScript
2
star
38

function-accessor.js

Higher-Order accessor functions.
JavaScript
2
star
39

greater-than.js

Whether given value or value within an object property is greater than X.
JavaScript
2
star
40

node-env-docker

Run a docker command with environment variables populated via .env.
JavaScript
2
star
41

node-tape-runner

A tape runner API allowing you to create custom test runners.
JavaScript
2
star
42

life

Proverbs 27:17 - As iron sharpens iron, so a friend sharpens a friend.
1
star
43

json-parse.js

Curried function that calls `JSON.parse` on provided input returning either the parsed JSON or the specified default value if the data fails to parse as valid JSON instead of throwing a `SyntaxError`.
JavaScript
1
star
44

node-envc-assert

A drop-in replacement for envc that also verifies specific environment variables are set.
JavaScript
1
star
45

reactq

A minimalist DSL for pub/sub in PHP
PHP
1
star
46

ifstring.erl

Erlang string predicates.
Erlang
1
star
47

pg-array

Convert arrays and delimited strings to PostgreSQL array representation.
JavaScript
1
star
48

cometd-jquery

JavaScript CometD Bayeux implementation with jQuery bindings packaged for npm.
JavaScript
1
star
49

string-split.js

A curried `String.prototype.split` with support for splitting by String, RegExp, or Function.
JavaScript
1
star
50

javascript-gotchas

JavaScript
1
star
51

node-authorized-keys

Platform agnostic path resolution to a user's authorized_keys file Node.js.
JavaScript
1
star
52

slidedecks

Slide Decks
Java
1
star
53

transfer

A convenient shell wrapper for http://transfer.sh.
Shell
1
star
54

node-git-origin-url

Retrieve the git remote origin URL of the current repo for Node.js.
JavaScript
1
star
55

function-pipeline.js

Similar to the Unix `|` operator; returns a function that invokes the given series of functions whose output is subsequently passed to the next function in the series.
JavaScript
1
star
56

take-last.js

Returns a new shallow copy of the last n elements taken from the end of the given array. When list.length < n the list returned contain list.length elements.
JavaScript
1
star
57

git-jenkins-status

Git extension to quickly check Jenkins build status.
Shell
1
star
58

array-mapcat.js

Curried function deriving new array values by applying provided function to each item/index of provided array then applying `concat` to the results. Fast and compatible with modern or old browsers.
JavaScript
1
star
59

knex-mysql-middleware

Set a MySQL flavored Knex connection that can be accessed via Koa or Express middleware.
JavaScript
1
star
60

wonlogo.svg

wonlogo.svg is the reference implementation for scalable unicode wordmark IDs. It promotes togetherness and inclusively while also celebrating one's individuality.
Shell
1
star
61

sum.js

Sum a list of number literals, nested object property values, or values returned from a custom function for Node.js and the browser.
JavaScript
1
star
62

array.filter.js

Curried function deriving a new array containing items from given array for which predicate returns true. Supports unary function, RegExp, dot/bracket-notation string path, and compound query object as predicate
JavaScript
1
star