Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Git Wrapper Laravel Package

graham-campbell/git-wrapper

A PHP wrapper around the Git command-line client that provides a clean, object-oriented API for running Git commands via Symfony Process. It simplifies repository operations like clone, checkout, commit, and log, with configurable binary paths and support for custom environments.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What the package is. A thin, object-oriented PHP wrapper around the git CLI. It shells out via symfony/process, returns structured output and exit codes, and throws GitException on failure. It adds no git capability of its own — every operation depends on the runtime binary and the filesystem state of a working copy. Treat it as a process-execution adapter, not a git implementation, and plan for the operational surface that implies.

Architecture fit. Appropriate only where "run git" is occasional and trusted-input: build/version stamping (git describe), changelog assembly from commit history, tag and branch inspection, repo metadata reads, and internal release/admin tooling. Poor fit for anything on the request path, anything multi-tenant, anything that lets external input reach refs/paths/remote URLs, and anything on ephemeral compute. The decision rule for planning: git work belongs in a queued job with a timeout, a capped output buffer, and a sandboxed working directory — never inline in a web request.

Integration feasibility. Mechanically trivial — composer require, instantiate, bind a configured singleton. Two questions must be resolved before design work is sequenced:

  • Packaging ambiguity. The package description and current assessment describe it as framework-agnostic (no service provider, no facade, no publishable config); an earlier note describes Laravel glue over cpliakas/php-git. The answer determines whether integration is ~10–50 lines in AppServiceProvider or a version-constraint fight against illuminate/support. Confirm on the installed version.
  • Resolution on the target Laravel. If any 1.x line carries Laravel 4.2/5.x-era constraints, expect no resolution on Laravel 10/11/12. This is a go/no-go spike in a throwaway app — run it before any design work, and hold the fallback (depend on the underlying library directly, register your own binding).

Technical risk.

  • Command-injection surface. Arguments are escaped by the library, but externally-derived branch names, refs, remote URLs, paths, and commit messages remain injection candidates and still need validation plus a sandboxed working directory. Verify escaping in the pinned version by reading GitCommand::__toString() — do not assume.
  • Binary CVEs become your CVEs. CVE-2022-24765 (safe.directory), CVE-2022-39253, and CVE-2024-32002 (submodule RCE on clone) enter the threat model. Composer audit will not surface these.
  • Process-execution constraints. Fails behind disable_functions, open_basedir, read-only filesystems; requires writable working copies and credentials on disk or in an agent.
  • Low adoption signal. Zero dependents, single maintainer, long release history. Not disqualifying for a small MIT utility, but you own the glue regardless of upstream activity.
  • No async, no pooling. Every call is a fork/exec.

v1.1.2 specifically. Patch-level with no prose changelog, consistent with dependency-constraint housekeeping. Semver patch implies no API change and does not alter the adoption calculus; read the compare link for exact bumps before pinning.

Key questions for the TPM to close before committing:

  1. Is git work being moved out of CI/deploy (usually right) or into the request path (usually wrong)?
  2. Is this actually a Laravel package (service provider + facade) or framework-agnostic core, on the version we would install?
  3. Does it resolve cleanly on our exact Laravel/PHP pair, or do we fall back to the underlying library with our own binding?
  4. What git version is guaranteed in every target runtime, and how is it patched?
  5. Does any call site pass externally-derived input into the API?
  6. Do working copies survive pod restarts, or is state ephemeral?

Integration Approach

Stack fit. PHP 8.x, modern Composer, pin ^1.1. Read it as framework-agnostic: require the package, then bind a configured singleton in AppServiceProvider with a fixed binary path, explicit timeout, and a logger. Do not publish or assume config that may not exist on this line. If the installed version is Laravel-glued to old constraints, take the fork-or-underlying-library path early rather than fighting the constraint.

Migration path, in preferred order.

  1. Eliminate runtime git first. Do the work at build/deploy time and consume the artifact. Check this before any design work — it is frequently the correct answer and it removes the entire risk surface.
  2. Depend on the underlying library directly and register your own singleton. The wrapper's value-add is DI and config; removing the extra hop is often worth the small ownership cost.
  3. Keep the wrapper but hide it behind your own interface (RepositoryInspector, ReleaseTagger) so it stays an implementation detail and a swap remains cheap.

Compatibility.

  • Pin the git binary in the base image and assert a minimum patched version at boot.
  • Set GIT_TERMINAL_PROMPT=0 and batch-mode SSH unconditionally so missing credentials fail fast instead of hanging a worker.
  • Bind one configured singleton — never new GitWrapper() at call sites.

Sequencing.

  1. Resolution spike against the target Laravel/PHP pair. Gate — may kill the option outright.
  2. Inventory call sites that would receive externally-derived arguments; decide validation and sandboxing per site.
  3. Define the internal interface and adapt the package behind it.
  4. Build a fixture suite against real temporary repositories, including failure cases: dirty tree, detached HEAD, missing remote, lock contention.
  5. Ship behind a flag on one low-risk workflow — changelog or repo metadata read. Never debut this on deployment.

Operational Impact

Maintenance. Single-maintainer, low-touch upstream line; budget for owning the glue regardless of upstream activity. The recurring obligation is tracking git binary advisories, not Composer advisories — most teams do not have that in process today, so assign it explicitly with a named owner and a review cadence.

Support. No vendor. Escalation is reading the source, which is small. The difficult knowledge is not the package — it is git CLI semantics and working-copy state, which is precisely the knowledge that is not transferable from the library's documentation.

Scaling. Each operation is a fork/exec; throughput is bounded by process spawn cost and disk I/O. Concurrent operations against the same working copy contend on .git/index.lock — the dominant failure mode under load, and not solved by adding workers. Horizontal scaling fails outright if working copies live on ephemeral storage: you need a shared volume, job-per-repository affinity (a queue with a repository key), or a design with no persistent working copy at all.

Failure modes to instrument from day one.

  • index.lock contention; partial or corrupt clones on timeout or cancellation.
  • Missing or outdated git binary after a base-image rebuild.
  • Ownership/permission errors when the PHP user is not the repo owner (safe.directory).
  • Credential prompt hanging a worker to timeout.
  • Unbounded stdout from large log/diff filling memory — cap the output buffer.
  • Orphaned git processes when the parent request is killed mid-clone.

Ramp-up. A competent Laravel developer is productive in days; the API is small and the failure semantics are ordinary subprocess semantics. The real cost is the long tail of runtime-git failure modes that surface in production months later. Budget the on-call surface, not the integration effort, as the actual line item — and frame it that way to stakeholders when scoping the first feature.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource