sebastianfeldmann/git
PHP library to access and interact with Git repositories. Provides a simple API for common Git commands and info (status, log, branches, tags), ideal for build scripts, CI tooling, and automation where you need Git data without shelling out manually.
Start by installing via Composer: composer require sebastianfeldmann/git. Once installed, instantiate the Git class (or Repository depending on version) by pointing it to an existing local Git repository path. Your first use case is likely inspecting repo status or running simple commands—e.g., $repo = new Git('/path/to/repo'); $status = $repo->status();. Check the README or examples/ directory for minimal snippets (if available); otherwise, the class constructor and factory methods like Repository::fromPath() are your entry points.
pull → checkout → fetch tags → build) in reusable methods or services.checkout('main')->pull()->fetch('--tags')).StatusResult, BranchResult) to safely extract structured data instead of raw strings.GitExceptions for failures; pair try/catch with descriptive logging or rollback logic for robust automation.GIT_DIR and GIT_WORK_TREE aren’t overridden externally; the library respects these but conflicts can cause silent errors.-c advice.detachedHead=false, etc.) to avoid hangs—avoid using interactive commands like rebase -i.git --version support matrix in source comments if seeing parse errors.Command classes or implement custom ResultParser interfaces if you need specialized parsing (e.g., for git log --pretty=format:).setOutputHandler() or inspect getLastCommand() on the client to replay failing commands manually in the shell.How can I help you explore Laravel packages today?