Home

Awesome

bash_unit CI Shellcheck CI GH Language GH stars GH tag GH License basher install

pforret/pa

Run php artisan and composer with the correct PHP version for the project, derived from composer.json

šŸ”„ Usage

Program : pa by peter@forret.com
Version : v0.1.1 (2023-01-08 21:29)
Purpose : php artisan replacement
Usage   : pa [-h] [-q] [-v] [-f] [-l <log_dir>] [-t <tmp_dir>] [-P <OVERRIDE_PHP>] <action>
Flags, options and parameters:
    -h|--help        : [flag] show usage [default: off]
    -q|--quiet       : [flag] no output [default: off]
    -v|--verbose     : [flag] also show debug messages [default: off]
    -f|--force       : [flag] do not ask for confirmation (always yes) [default: off]
    -l|--log_dir <?> : [option] folder for log files   [default: /home/pforret/log/pa]
    -t|--tmp_dir <?> : [option] folder for temp files  [default: /tmp/pa]
    -P|--OVERRIDE_PHP <?>: [option] override PHP binary to use (e.g. php8.1)
    <action>         : [parameter] action to perform (see pa -h for details)
āœ…  Remote: gh_pforret:pforret/pa.git
                                  
### TIPS & EXAMPLES
* use pa list to show the available PHP versions on this machine
  pa list
* use pa pick to show the best PHP version for this machine/repo
  pa pick
* use pa co to run 'composer' with the optimal PHP version
  pa co require author/package
  pa co install

āš”ļø Examples

# run `php artisan`, but with the correct PHP version for this project
$ pa route:list
$ pa make:model ModelName

# run `composer install`, with the correct PHP version
> pa c install
> pa co install
> pa com install
> pa comp install
> pa composer install

# run `composer require` author/package, with the correct PHP version
> pa co require author/package

# run 'pa pick' to see what PHP version would be chosen in this folder
# will parse PHP requirements from composer.json like "^8.0" or "^7.4|^8.0" 
# and use the lowest version of PHP that is installed and qualifies
$ pa pick
/usr/bin/php7.4

# show all available PHP versions on this machine
> pa list
# Installed on this machine [name]:
# - - - - - - - - - - - - - - - - - - - - -
# /usr/bin/php              8.0.26          āœ…  Supported until 2023-11-26
# /usr/bin/php8.2           8.2.0           āœ…  Supported until 2025-12-08
# /usr/bin/php8.1           8.1.13          āœ…  Supported until 2024-11-25
# /usr/bin/php8.0           8.0.26          āœ…  Supported until 2023-11-26
# /usr/bin/php7.4           7.4.33          ā›”  Unsupported since 2022-11-28
# /usr/local/bin/composer   2.5.1 2022-12-22

šŸš€ Installation

with basher

$ basher install pforret/pa

or with git

$ git clone https://github.com/pforret/pa.git
$ cd pa

šŸ“ Acknowledgements

Ā© 2022 Peter Forret