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
Gitelephant

Gitelephant Laravel Package

cypresslab/gitelephant

GitElephant is a PHP abstraction layer for managing Git repositories. It wraps the git binary in an object-oriented API, letting you inspect history, branches, tags, commits, and files without handling raw command output. Requires PHP 7.2+ and Git on a Unix-like system.

View on GitHub
Deep Wiki
Context7

An abstraction layer for git written in PHP

Frequently asked questions about Gitelephant
What is GitElephant used for in Laravel applications?
GitElephant is an object-oriented PHP wrapper around the Git CLI, useful when a Laravel app needs to inspect or manage a local Git repository. Typical uses include CMS revision history, snippet or collaboration tooling, commit and diff analytics, and replacing ad hoc shell Git calls in CI helpers. It keeps raw command output out of your application code.
Does GitElephant support Laravel 10, 11, and 12?
Yes, GitElephant is Laravel-agnostic and its v5 Symfony 6.4+ constraint aligns well with Laravel 10, 11, and 12 dependency sets. Laravel 9-era installs are not a realistic target for v5 because the Symfony floor drops older dependency sets. Composer resolution against your app's Symfony major is the main compatibility check.
How do I install GitElephant in a Laravel project?
Use composer require matteosister/gitelephant, but verify the current Packagist identity first because the repository is matteosister/GitElephant while older docs and badges reference cypresslab/gitelephant. Then bind any GitElephant classes you need in your own Laravel service provider if you want container injection. Confirm Git is installed on the host and the repository path is readable by PHP.
What are the requirements for GitElephant v5?
GitElephant v5 requires PHP 8.1 or newer, Symfony 6.4, 7.x, or 8.x components, and Git on a Unix-like system. The README historically listed PHP 7.2 for older releases, but the v5 floor is PHP 8.1. It also expects a local repository filesystem path rather than only a remote Git host.
Can GitElephant inspect commits, branches, tags, and diffs?
Yes, GitElephant exposes repositories, commits, branches, tags, files, and diffs through an OOP API. It reads Git output and builds objects so you do not have to parse raw command responses yourself. This makes it suitable for history views, revision comparisons, and programmatic Git analytics.
How do I test Laravel code that uses GitElephant?
Mock GitElephant at the repository level so most tests do not need to shell out to real Git. For integration tests, create a temporary local repository with known commits and branches, then assert the object results. The package's PHPUnit 10 or 11 upgrade is internal and does not force your app's PHPUnit version unless you extend their test scaffolding or run their suite in your CI.
Is GitElephant safe to use in production?
GitElephant shells out to the Git binary through Symfony Process, so production safety depends on controlling repository paths, permissions, timeouts, and argument inputs. It avoids leaking exec calls into your application code, but it is not a sandbox and should not receive untrusted paths or ref names without validation. Run it with a least-privilege system user and test failures such as missing Git or locked repositories.
How does GitElephant compare with exec git or league/git?
GitElephant provides an object-oriented abstraction over the Git CLI, whereas raw exec('git ...') leaves parsing, escaping, and error handling to you. league/git is an alternative but is less active according to the assessment, and Git host REST APIs are preferable when the repository is remote. GitElephant is the best fit when the repository is local to the Laravel app filesystem.
What breaks when upgrading GitElephant from v4 to v5?
The main upgrade risks are the PHP 8.1 floor, the Symfony 6.4+ requirement, and the PSR-0 to PSR-4 autoloading switch. Normal use statements should be transparent, but custom classmaps, non-PSR-4 internal class references, or custom autoloaders can break. Pin matteosister/gitelephant:^4.6 until your app is ready for PHP 8.1+ and Symfony 6.4+, then upgrade deliberately.
Is GitElephant actively maintained and what license does it use?
GitElephant is community-maintained rather than a first-party Laravel package. The v5 release modernized the toolchain and dependency constraints, which indicates ongoing maintenance, but you should review repository activity and release cadence before relying on it long term. Re-verify the license against the repository; it has historically been MIT, not LGPL-3.0 as sometimes stated.
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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator