From 2f624af0662575cb6e14e8bcd62984c380a56874 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.uk>
Date: Thu, 30 Jul 2020 01:17:38 +0100
Subject: [PATCH] zsh: Run Composer with Docker

---
 tag-zsh/zsh/configs/functions.zsh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tag-zsh/zsh/configs/functions.zsh b/tag-zsh/zsh/configs/functions.zsh
index 1a2141fa..315f83a3 100644
--- a/tag-zsh/zsh/configs/functions.zsh
+++ b/tag-zsh/zsh/configs/functions.zsh
@@ -15,6 +15,15 @@ function db {
 is_linux() { [[ "$(uname)" == 'Linux'  ]] }
 is_macos() { [[ "$(uname)" == "Darwin" ]] }
 
+function composer() {
+  docker run -u $UID -it --rm \
+    -v $(pwd):/app \
+    -v ~/.composer:/root/.composer \
+    -v ~/.ssh:/root/.ssh \
+    composer \
+    composer $*
+}
+
 # Run 'phpunit' or 'pest' depending on the project.
 function p () {
   vendor/bin/$(phpunit-or-pest) $*;