Giter VIP home page Giter VIP logo

Comments (4)

wilmoore avatar wilmoore commented on June 3, 2024 1

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.

vincentchalamon avatar vincentchalamon commented on June 3, 2024 1

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.

wilmoore avatar wilmoore commented on June 3, 2024 1

direnv/direnv#250

from php-version.

wilmoore avatar wilmoore commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.