Skip to content

Instantly share code, notes, and snippets.

@g1ibby
Created February 2, 2016 16:36
Show Gist options
  • Save g1ibby/ee619a36cc00cf127ae7 to your computer and use it in GitHub Desktop.
Save g1ibby/ee619a36cc00cf127ae7 to your computer and use it in GitHub Desktop.
Using local packages as composer dependencies

When implementing your project, the need for some module, library, service provider or something else will arise, and sometimes you’ll have to implement it yourself. So, how to do that? The solution to this problem is described here. I like this decision all but speed. Therefore, it was written this script that clones the local repository with the package into a folder of your project vendor.

name_package="" # Name package in format: ****/*****
local_path="" # Full path to local repository
#!/usr/bin/env bash
# Force Update Package for development composer package
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
. ./fup.conf # Connect configuration file
cd ${local_path}
CHANGED=$(git status --porcelain)
if [ -n "${CHANGED}" ]; then
echo "${RED} All changes must be fixed ${NC}"
else
cd -
rm -rf ./vendor/${name_package}/
mkdir ./vendor/${name_package}/
git clone ${local_path} ./vendor/${name_package}/
echo "${GREEN}$local_path${NC} >>>> ${RED}./vendor/$name_package/${NC}"
echo " "
echo "Composer package has been updated to force out the local repository"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment