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.
git CLI gives you clone, commit, branch, tag, merge, diff, and status with structured output and exceptions on failure. Any spec that says "history," "diff," "rollback," or "release tagging" has its plumbing risk largely removed — no bespoke exec() layer, no hand-parsed stdout, no homegrown audit table.Adopt when:
git binary is installed and patched, the PHP process user can write to the working copies, and storage survives restarts.RepositoryInspector, ReleaseTagger) so it stays an implementation detail rather than a dependency leaking across the codebase.Look elsewhere when:
disable_functions, read-only filesystems, or open_basedir restrictions.Adoption caution worth flagging to planning: this is a low-signal dependency — effectively zero dependent packages, no stars, a single maintainer, and a legacy Laravel compatibility line. Expect resolution friction on Laravel 10+ and budget a spike to confirm it installs on your exact PHP/Laravel pair before any design work. Plan for the possibility that you depend on the underlying php-git library directly with your own binding instead.
For executives: A small, MIT-licensed PHP library that lets our application talk to git directly, without us building and maintaining subprocess plumbing. It removes roughly a sprint of undifferentiated engineering from any feature involving version history, rollback, changelog generation, or release tooling, and it carries no licensing cost and no vendor lock-in — we can pin it and remove it without touching product code. The honest risk framing: it's a niche dependency with a single maintainer and no downstream adoption signal, and it requires the git binary and writable repositories at runtime. That makes it a good fit for internal tooling and content-versioning features, and a poor fit for anything customer-facing on the request path. Recommendation: adopt behind our own interface, prove it on one low-risk internal workflow, and treat the real budget as operational on-call for git binary patching rather than the integration itself.
For engineering: Framework-agnostic wrapper over the git CLI — no service provider, no facade, no config to publish on this line, so the wiring is ours. It requires the git binary plus filesystem permissions on the working copies, so every call belongs in a queued job with a timeout, a capped output buffer, and GIT_TERMINAL_PROMPT=0 so a missing credential fails fast instead of hanging a worker. Arguments are escaped by the library, but user-supplied refs and paths still need validation and a sandboxed working directory. Pin git in the base image and assert a minimum patched version at boot — git CVEs become our CVEs and Composer audit won't surface them. Watch .git/index.lock contention: concurrent operations against the same working copy is the dominant failure mode, and adding workers does not solve it. Before committing, run a resolution spike on our Laravel version — this line targets much older illuminate/support constraints and may need a fork or a direct dependency on the underlying library.
How can I help you explore Laravel packages today?