Comments (4)
Hi @vincentchalamon - Thanks for using this. Rather than bloating this tool with such a feature, I'd highly recommend using direnv to switch versions.
You'll need to create a custom ~/.direnvrc
file to support the .php-version
file. The following article will get you going...just swap all the ruby concepts with php concepts:
http://tooky.co.uk/using-direnv-and-chruby-together
Alternatively, you can contribute a direnv stdlib function like the one for Node.js:
https://github.com/direnv/direnv/blob/0f803e6a42325f08f0291a78f79f973a5f01f488/stdlib.sh#L466-L529
Best of luck and definitely let me know how things work out.
from php-version.
Wow, thank you so much for this wonderful resource :-) Works perfectly with following function (in my ~/.direnvrc
file):
# use php [version]
use_php() {
local ver=$1
if [[ -z $ver ]] && [[ -f .php-version ]]; then
ver=$(cat .php-version)
fi
if [[ -z $ver ]]; then
echo Unknown php version
exit 1
fi
source $(brew --prefix php-version)/php-version.sh && php-version $ver
}
Then, I created a .envrc
file in my project with the PHP version I want to use for current project: use php 5.6
Thank you !!!
from php-version.
from php-version.
Awesome! When I have some free time, I'll definitely try to port this over to a direnv stdlib function...if you don't beat me to it 😃
from php-version.
Related Issues (20)
- Support for release-candidates installed by Homebrew HOT 2
- brew install doesn't create symlink HOT 3
- init script is not finding my brew-installed php versions. all installed today. HOT 15
- Sorry, but php-version was unable to find version '5' under ''. HOT 14
- line 43: /usr/local/Library/ENV/4.3/sed: No such file or directory HOT 13
- No symlink for /usr/local/bin/php HOT 1
- Re-write in a language that can produce a standalone binary
- [Feature] Switch PHP versions when entering in a project folder HOT 1
- I change the php version but the php-fpm does not change
- Add changelog HOT 1
- doesn't switch between version 5.3.29 and 5.6.33
- brew versions not picked up anymore HOT 4
- php-version has been removed from homebrew HOT 7
- Doesn't switch versions on ubuntu HOT 4
- Can not work HOT 3
- homebrew/php was deprecated HOT 4
- 无法安装了 HOT 1
- Readme is misleading about windows support HOT 2
- Does not work with fish 3.1.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-version.