This script will help you in developing composer packages
OS:
- Linux
- MacOS
libs:
- curl
- jq
For install the packages jq and curl
# Linux
sudo apt install jq curl
# MacOS
brew install jq curlTo install composer-local and composer-dev, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL command:
curl -s -o- https://raw.githubusercontent.com/ibec-box/composer-dev/main/install.sh | sudo bashInside the project where the composer.json file exists, use the composer-local command instead of composer. Examples:
composer-local install
composer-local update
composer-local dump-autoload
# ... and other composer commandsThese commands copy your composer.json file in composer.local.json, with the addition of the "repositories" key, where the path to the folder with composer packages is specified.
And local packages should be installed in the PROJECT folder:
./composer-packages/{username}/{package-name}
I recommend adding working files to your .gitignore file
echo composer-packages >> .gitignore
echo composer.local.json >> .gitignore
echo composer.local.lock >> .gitignoreAlso, you may use command composer-dev,
composer-dev install
composer-dev update
composer-dev dump-autoload
# ... and other composer commandsThis command working like composer-local. But packages should be installed in the $HOME folder:
~/composer-packages/{username}/{package-name}
I recommend adding working files to your .gitignore file
echo composer.dev.json >> .gitignore
echo composer.dev.lock >> .gitignoreIf you want to use this script for only one local project, you can download the script to your project using the command:
curl -s -o composer-local https://raw.githubusercontent.com/ibec-box/composer-dev/main/composer-local.sh
chmod +x composer-localThen use the command in the project directory ./composer-local {option}