PHPackages                             davidrjonas/composer-lock-diff - 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. davidrjonas/composer-lock-diff

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

davidrjonas/composer-lock-diff
==============================

See what has changed after a composer update.

1.7.1(1y ago)2801.8M—3.5%19[8 issues](https://github.com/davidrjonas/composer-lock-diff/issues)[4 PRs](https://github.com/davidrjonas/composer-lock-diff/pulls)7MITPHP

Since Nov 15Pushed 1y ago6 watchersCompare

[ Source](https://github.com/davidrjonas/composer-lock-diff)[ Packagist](https://packagist.org/packages/davidrjonas/composer-lock-diff)[ RSS](/packages/davidrjonas-composer-lock-diff/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (13)Used By (7)

composer-lock-diff
==================

[](#composer-lock-diff)

See what packages have changed after you run `composer update` by comparing composer.lock to the the git HEAD.

Requires:

- php &gt;= 5.3

There are no other dependencies.

Install
-------

[](#install)

```
composer global require davidrjonas/composer-lock-diff:^1.0

# With zsh, run `rehash` to make it known to the shell.

# try it
composer-lock-diff --help
```

If `composer-lock-diff` is not found, make sure `~/.composer/vendor/bin` is in your `$PATH` env variable. For more information on how to do that see [this question on Stack Overflow](https://stackoverflow.com/questions/25373188/laravel-installation-how-to-place-the-composer-vendor-bin-directory-in-your).

Usage
=====

[](#usage)

```
composer update
# don't commit yet!
composer-lock-diff
```

Or from vim, to insert the output into the commit message, type `:r!composer-lock-diff`.

### Options

[](#options)

- `-h, --help`: Print this message
- `-p, --path`: Base to with which to prefix paths. Default "./"
    E.g. `-p app` would look for HEAD:app/composer.lock and app/composer.lock
- `--from`: The file^, git ref, or git ref with filename to compare from (git: HEAD:composer.lock, svn: composer.lock@BASE)
- `--to`: The file^, git ref, or git ref with filename to compare to (composer.lock)
- `--json`: Format output as JSON
- `--pretty`: Pretty print JSON output (PHP &gt;= 5.4.0)
- `--md`: Use markdown instead of plain text
- `--no-links`: Don't include Compare links in plain text or any links in markdown
- `--only-prod`: Only include changes from `packages`
- `--only-dev`: Only include changes from `packages-dev`
- `--vcs`: Force vcs (git, svn, ...). Default: attempt to auto-detect

^ File includes anything available as a [protocol stream wrapper](http://php.net/manual/en/wrappers.php) such as URLs.

Example Plain Text Table Output
===============================

[](#example-plain-text-table-output)

```
+--------------------+-------+--------+------------------------------------------------------------------+
| Production Changes | From  | To     | Compare                                                          |
+--------------------+-------+--------+------------------------------------------------------------------+
| guzzlehttp/guzzle  | 6.2.0 | 6.3.0  | https://github.com/guzzle/guzzle/compare/6.2.0...6.3.0           |
| hashids/hashids    | 2.0.0 | 2.0.4  | https://github.com/ivanakimov/hashids.php/compare/2.0.0...2.0.4  |
| league/flysystem   | 1.0.0 | 1.0.42 | https://github.com/thephpleague/flysystem/compare/1.0.0...1.0.42 |
| monolog/monolog    | NEW   | 1.21.0 |                                                                  |
+--------------------+-------+--------+------------------------------------------------------------------+

+------------------+--------+---------+---------+
| Dev Changes      | From   | To      | Compare |
+------------------+--------+---------+---------+
| phpspec/php-diff | v1.0.2 | REMOVED |         |
+------------------+--------+---------+---------+

```

Markdown Table
==============

[](#markdown-table)

### Raw

[](#raw)

```
| Production Changes | From  | To     | Compare                                                                 |
|--------------------|-------|--------|-------------------------------------------------------------------------|
| guzzlehttp/guzzle  | 6.2.0 | 6.3.0  | [...](https://github.com/guzzle/guzzle/compare/6.2.0...6.3.0)           |
| hashids/hashids    | 2.0.0 | 2.0.4  | [...](https://github.com/ivanakimov/hashids.php/compare/2.0.0...2.0.4)  |
| league/flysystem   | 1.0.0 | 1.0.42 | [...](https://github.com/thephpleague/flysystem/compare/1.0.0...1.0.42) |
| monolog/monolog    | NEW   | 1.21.0 |                                                                         |

| Dev Changes      | From   | To      | Compare |
|------------------|--------|---------|---------|
| phpspec/php-diff | v1.0.2 | REMOVED |         |

```

### Rendered

[](#rendered)

Production ChangesFromToCompareguzzlehttp/guzzle6.2.06.3.0[...](https://github.com/guzzle/guzzle/compare/6.2.0...6.3.0)hashids/hashids2.0.02.0.4[...](https://github.com/ivanakimov/hashids.php/compare/2.0.0...2.0.4)league/flysystem1.0.01.0.42[...](https://github.com/thephpleague/flysystem/compare/1.0.0...1.0.42)monolog/monologNEW1.21.0Dev ChangesFromToComparephpspec/php-diffv1.0.2REMOVEDDevelopment
===========

[](#development)

New features are always welcome! Follow these guidelines

- Try to match the style of the code that already exists, even if it isn't *your* style (sorry!).
- Make sure there is a way to test the feature.
- Test with PHP 5.3 (I'm serious!), &gt;=5.4&lt;7, 7.current. Docker is helpful, particularly for the older versions. Just run the ubuntu:12.04 image and install php for 5.3 and 14.04 for 5.6. I can help if you're having trouble.

The [Makefile](Makefile) has some test cases. Run `make | less` and inspect the output. If you need specific versions or more information, continue reading.

To run using the test data manually simply point the `--to` and `--from` args at the lock files,

```
php ./composer-lock-diff --from ./test-data/composer.from.lock --to ./test-data/composer.to.lock
```

Docker is very helpful for targeting a specific version of php and/or composer,

```
docker run --rm -it -v "$PWD":/src -w /src php:7.4.2 \
  php ./composer-lock-diff --from ./test-data/composer.from.lock --to ./test-data/composer.to.lock
```

Sometimes you want to test the git related functions. To do that first I make a temporary repo. Then I copy into it `test-data/composer.from.lock` as `composer.lock` to set the previous state and `test-data/composer.to.json` as `composer.json` for the future state. I commit those then run `composer-lock-diff` with the options I want to test and visually inspect the results.

```
mkdir tmp && cd tmp
git init
cp ../test-data/composer.to.json composer.json
cp ../test-data/composer.from.lock composer.lock
git add .
git commit -m "initial"

composer update
# or
docker run --rm -it -v "$PWD":/src -w /src composer:latest php composer update

php ../composer-lock-diff

# or, if you want to use docker, you'll need git
cd ..
docker run --rm -it -v "$PWD":/src -w /src php:7.4.2 bash
apt-get update && apt-get install -y git
# You may want composer as well,
curl -OL https://getcomposer.org/download/1.9.3/composer.phar
cd tmp
php ../composer.phar update
php ../composer-lock-diff
```

Add a test case to test-data/
-----------------------------

[](#add-a-test-case-to-test-data)

- Make a new, temporary git repo in `./tmp`
- Copy `../test-data/composer.from.json` as `composer.json` and `../test-data/composer.from.lock` as `composer.lock`.
- Commit them.
- Run `composer install`
- Add your *pre* case to `composer.json`. Use an exact version.
- Run `composer update`.
- The generated `composer.lock` should look similar to `../test-data/composer.from.lock` but there will be differences due to transient dependencies. No real way around that. Use `composer-lock-diff` to make sure none of the named packages change versions and your new case is there.
- Copy `composer.json` to `../test-data/composer.from.json` and `composer.lock` to `composer.from.lock`.
- Copy `../test-data/composer.to.json` as `composer.json`.
- Add your *post* case to `composer.json`. Again, exact versions are best.
- Generate a new lock file.
- Use composer-lock-diff to test your feature.
- When you're happy with it, copy `composer.json` to `../test-data/composer.to.json` and `composer.lock` to `../test-data/composer.to.lock`.

Test Cases
----------

[](#test-cases)

See [Makefile](Makefile).

- `comopser-lock-diff` # no args
- `composer-lock-diff --from ./test-data/composer.from.lock --to ./test-data/composer.to.lock`
- `composer-lock-diff --path ./test-data/`
- `composer-lock-diff --from ` # this gets tested with 'no args'
- `composer-lock-diff --from `
- `composer-lock-diff --to `
- `composer-lock-diff --to `
- `composer-lock-diff --only-dev`
- `composer-lock-diff --only-prod`
- `composer-lock-diff --no-links`
- `composer-lock-diff --json`
- `composer-lock-diff --json --pretty`
- `composer-lock-diff --md`
- `composer-lock-diff --md --no-links`

If anyone can help test with Windows that would be very much appreciated!

Contributors
============

[](#contributors)

Thanks to everyone who has shared ideas and code! In particular,

-
-
-
-
-
-
-
-
-
-

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance41

Moderate activity, may be stable

Popularity59

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 56.8% 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 ~299 days

Recently: every ~491 days

Total

11

Last Release

480d ago

### Community

Maintainers

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

---

Top Contributors

[![djonas-noip](https://avatars.githubusercontent.com/u/182177303?v=4)](https://github.com/djonas-noip "djonas-noip (46 commits)")[![davidrjonas](https://avatars.githubusercontent.com/u/6118591?v=4)](https://github.com/davidrjonas "davidrjonas (17 commits)")[![hakre](https://avatars.githubusercontent.com/u/378849?v=4)](https://github.com/hakre "hakre (8 commits)")[![soleuu](https://avatars.githubusercontent.com/u/7995375?v=4)](https://github.com/soleuu "soleuu (3 commits)")[![jibran](https://avatars.githubusercontent.com/u/2111106?v=4)](https://github.com/jibran "jibran (2 commits)")[![xurizaemon](https://avatars.githubusercontent.com/u/105608?v=4)](https://github.com/xurizaemon "xurizaemon (1 commits)")[![delamart](https://avatars.githubusercontent.com/u/906515?v=4)](https://github.com/delamart "delamart (1 commits)")[![ihor-sviziev](https://avatars.githubusercontent.com/u/1873745?v=4)](https://github.com/ihor-sviziev "ihor-sviziev (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")[![BorisovskiP](https://avatars.githubusercontent.com/u/12116001?v=4)](https://github.com/BorisovskiP "BorisovskiP (1 commits)")

---

Tags

composercomposer-lockcomposer-lock-diffdifflockphpplugin

### Embed Badge

![Health badge](/badges/davidrjonas-composer-lock-diff/health.svg)

```
[![Health](https://phpackages.com/badges/davidrjonas-composer-lock-diff/health.svg)](https://phpackages.com/packages/davidrjonas-composer-lock-diff)
```

###  Alternatives

[yahnis-elsts/admin-notices

A utility library for WordPress plugins that makes it easier to create admin notices. Supports persistently dismissible notices.

311.1k](/packages/yahnis-elsts-admin-notices)[jahvi/magento2-copy-theme-override

Magento 2 command to automatically copy files into active theme

124.5k](/packages/jahvi-magento2-copy-theme-override)

PHPackages © 2026

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