PHPackages                             xwillq/git-stage-editor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xwillq/git-stage-editor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xwillq/git-stage-editor
=======================

PHP package for editing staged files in git

1.0.4(3y ago)0569[1 PRs](https://github.com/xwillq/git-stage-editor/pulls)1MITPHPPHP ^8.0

Since Sep 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xwillq/git-stage-editor)[ Packagist](https://packagist.org/packages/xwillq/git-stage-editor)[ Docs](https://github.com/xwillq/git-stage-editor)[ RSS](/packages/xwillq-git-stage-editor/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (7)Used By (1)

git-stage-editor
================

[](#git-stage-editor)

When you stage files, git adds them to its object store in `.git/objects`. So when you edit file in working directory, staged files stay unchanged until you add them with `git add`. That's cool, until you want to perform some actions on staged files themselves. You can always stash local changes, edit files, stage them, and get changes back from the stash. But this way you might get some merge conflicts when unstaging. This may be fine when you are editing files yourself, but what if you want to edit them with scripts? For example, lint your code with git hooks.

The solution: edit files directly in the staging area. This library can help you do this by retrieving file from stage and presenting temporary file with its contents to you. All you have to do is pass a closure, that will modify this file, and it will be modified and saved back to stage.

Usage
-----

[](#usage)

1. Install `git-stage-editor` into your project ```
    composer require --dev xwillq/git-stage-editor
    ```
2. Instantiate `GitStagedFileEditor` with full path to your git repository ```
    $editor = new \Xwillq\GitStageEditor\GitStagedFileEditor($git_root);
    ```
3. Run it with your callback ```
    $editor->execute(function ($file, string $file_path) {
        exec("php vendor/bin/php-cs-fixer fix $file_path");
    });
    ```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

1397d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eaeffc3657f9b5d399f905ecd93ab4e5215fe8f6f38ad010c1f9d20fe686edfa?d=identicon)[xwillq](/maintainers/xwillq)

---

Top Contributors

[![xwillq](https://avatars.githubusercontent.com/u/38136135?v=4)](https://github.com/xwillq "xwillq (6 commits)")

---

Tags

git

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xwillq-git-stage-editor/health.svg)

```
[![Health](https://phpackages.com/badges/xwillq-git-stage-editor/health.svg)](https://phpackages.com/packages/xwillq-git-stage-editor)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M24.9k](/packages/friendsofphp-php-cs-fixer)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k40](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k14](/packages/tempest-framework)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
