PHPackages                             human018/laravel-patch - 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. [Database &amp; ORM](/categories/database)
4. /
5. human018/laravel-patch

ActiveLibrary[Database &amp; ORM](/categories/database)

human018/laravel-patch
======================

Perform migrations and database patches within your Laravel application

0.0.6(3y ago)022MITPHPPHP &gt;=7.3

Since Aug 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Human018/laravel-patch)[ Packagist](https://packagist.org/packages/human018/laravel-patch)[ RSS](/packages/human018-laravel-patch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (7)Used By (0)

[![Contributors](https://camo.githubusercontent.com/5f231c6a615349bc140f3e580ecf7099fc8daa48525cc43604d35e9bba378c10/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f68756d616e3031382f6c61726176656c2d70617463682e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/Human018/laravel-patch/graphs/contributors)[![Forks](https://camo.githubusercontent.com/d9bf75235caa912a29d9ad7a564a63522086e9b5d0f46cae263c8f707e35ac99/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f68756d616e3031382f6c61726176656c2d70617463682e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/Human018/laravel-patch/network/members)[![Stargazers](https://camo.githubusercontent.com/13092138c37d238ae378a43c4de1ffae5d27e128658aa851f0ea50e84de339cc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f68756d616e3031382f6c61726176656c2d70617463682e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/Human018/laravel-patch/stargazers)[![Issues](https://camo.githubusercontent.com/a0036841abf1cb5e44846ff3863e74949c00cace1494b553196b26e2b7bbbb66/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f68756d616e3031382f6c61726176656c2d70617463682e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/Human018/laravel-patch/issues)[![MIT License](https://camo.githubusercontent.com/62d6eaa35b05ab2c124ea93b6e8c4225c0238319ce54d91c5a78e3089ac2aba9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f68756d616e3031382f6c61726176656c2d70617463682e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/Human018/laravel-patch/blob/main/LICENSE)

Laravel Patch
=============

[](#laravel-patch)

Perform migrations and database patches within your Laravel application

---

At times you may need to run a database migration and then perform some kind of patch associated with the migration. This package will create both the migration and an associated patch command, it will listen for the migration event and then run the patch command automatically for you.

### When might you use this package?

[](#when-might-you-use-this-package)

#### Example 1:

[](#example-1)

You're changing a model relationship to an immediate relationship (hasMany) rather than a distant relation (hasManyThrough). You need to add a new foreignId column to the target models table and then populate that column with the correct ID's. With this package you can create both the migration and the patch command and then run them within the same migration command.

Index
-----

[](#index)

- [Usage](#usage)
    - [Requirements](#requirements)
    - [Download &amp; Installation](#download--installation)
    - [Performing Patches](#performing--patches)
    - [Migration Direction](#migration--direction)
- [License](#license)

Usage
-----

[](#usage)

### Requirements

[](#requirements)

- PHP 7.4
- Laravel 8

### Download &amp; Installation

[](#download--installation)

```
$ composer require human018/laravel-patch
```

Laravel will auto discover the package.

### Performing Patches

[](#performing-patches)

Once installed a patch can be created by running the following command in line with the regular Laravel make:migration command.

```
$ php artisan make:patch {name} {table|create}
```

This will generate both the migration and an associated patch command.

The package listens for when a migration event is fired, determines if there is an associated patch command and fires the command.

You will find Patch commands created in your projects 'Commands' folder under the subdirectory 'Patches', where you can perform any tasks that need to be done in line with this migration.

### Migration Direction

[](#migration-direction)

The migration direction is passed to the Patch Command using the 'method' option.

```
$this->input->getOption('method'); // Returns 'up' or 'down'
```

So if you need to revert some changes you can detect the 'down' direction.

License
-------

[](#license)

This project is licensed under the MIT License

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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 ~57 days

Recently: every ~72 days

Total

6

Last Release

1440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2add437b935f0c09ec7b39cbd9c887d43b5d57918336b70223d29a8ca7830c55?d=identicon)[Human018](/maintainers/Human018)

---

Top Contributors

[![Human018](https://avatars.githubusercontent.com/u/8413094?v=4)](https://github.com/Human018 "Human018 (7 commits)")

---

Tags

laravel

### Embed Badge

![Health badge](/badges/human018-laravel-patch/health.svg)

```
[![Health](https://phpackages.com/badges/human018-laravel-patch/health.svg)](https://phpackages.com/packages/human018-laravel-patch)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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