PHPackages                             latevaweb/laravel-query-updater - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. latevaweb/laravel-query-updater

ActiveLibrary[HTTP &amp; Networking](/categories/http)

latevaweb/laravel-query-updater
===============================

Easily update Eloquent models from put API requests without losing data

0.1.5(1y ago)01.2k2[3 PRs](https://github.com/latevaweb/laravel-query-updater/pulls)MITPHPPHP ^7.3|^8.2|^8.3

Since Dec 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/latevaweb/laravel-query-updater)[ Packagist](https://packagist.org/packages/latevaweb/laravel-query-updater)[ Docs](https://github.com/latevaweb/laravel-query-updater)[ RSS](/packages/latevaweb-laravel-query-updater/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (4)Versions (15)Used By (0)

Build Eloquent update queries from put API requests
===================================================

[](#build-eloquent-update-queries-from-put-api-requests)

[![Quality Score](https://camo.githubusercontent.com/f5a3c1a1169812357aec0b722f1ba3aa87b554cf157a1ef71fc09acfc0a4ea18/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61746576617765622f6c61726176656c2d71756572792d757064617465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/latevaweb/laravel-query-updater/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/14a6260f6e0678e2dbb5f21db9727d3fc4193830d59fd32639cff4e2108ec7a3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61746576617765622f6c61726176656c2d71756572792d757064617465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/latevaweb/laravel-query-updater/?branch=master)[![Build Status](https://camo.githubusercontent.com/d8f0ba02abbcafc5c7d0050481322a2ad983f91724ca2e6be21294c57b4a6857/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61746576617765622f6c61726176656c2d71756572792d757064617465722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/latevaweb/laravel-query-updater/build-status/master)[![StyleCI](https://camo.githubusercontent.com/46723233f1425cafb9b260598f73a3c5f45df0eb7e34f92349fac9d97ab379f1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3232373832313137392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/227821179)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Laravel 6.x](https://camo.githubusercontent.com/8333c1fae9a342ecc33e082cf504539043e98f24028a9df0513db89db6a82d1b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d362e782d6f72616e67652e737667)](http://laravel.com)

This package allows you to update fields and relations based on a request without losing data not send.

Installation
------------

[](#installation)

This package can be used in Laravel 6.0 or higher.

You can install the package via composer:

`composer require latevaweb/laravel-query-updater`

The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:

```
'providers' => [
    // ...
    LaTevaWeb\QueryUpdater\QueryUpdaterServiceProvider::class,
];
```

Basic usage
-----------

[](#basic-usage)

### Update model field based on a `put` or `patch` request: `/users` params: `['name' => 'Marc']`:

[](#update-model-field-based-on-a-put-or-patch-request-users-params-name--marc)

```
use LaTevaWeb\QueryUpdater\QueryUpdater;

public function __invoke(Request $request, User $user) {
    QueryUpdater::for($user)
        ->updatedFields(['name'])
        ->save();

    // update
}
```

### Update model field but keep stored value if parameter is empty or null

[](#update-model-field-but-keep-stored-value-if-parameter-is-empty-or-null)

```
use LaTevaWeb\QueryUpdater\QueryUpdater;
use LaTevaWeb\QueryUpdater\KeepStored;

public function __invoke(Request $request, User $user) {
    QueryUpdater::for($user)
        ->updatedFields([
            KeepStored::field('name')
        ])
        ->save();

    // update
}
```

Extending filters
-----------------

[](#extending-filters)

IF you have an special requirement that not fits with our filters `KeepStored` or `SimpleFilter`, you can create your own extending `LaTevaWeb\QueryUpdater\Filter\AbstractFilter` class.

Run tests
---------

[](#run-tests)

sqlite is required. Install it on ubuntu using `sudo apt-get install php7.4-sqlite3`.

execute `vendor/bin/phpunit`

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~338 days

Recently: every ~423 days

Total

6

Last Release

697d ago

PHP version history (2 changes)0.1.0PHP ^7.1

0.1.5PHP ^7.3|^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/51783643?v=4)[La Teva Web](/maintainers/LaTevaWeb)[@latevaweb](https://github.com/latevaweb)

---

Top Contributors

[![latevaweb](https://avatars.githubusercontent.com/u/51783643?v=4)](https://github.com/latevaweb "latevaweb (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![rafatga](https://avatars.githubusercontent.com/u/3813277?v=4)](https://github.com/rafatga "rafatga (1 commits)")

---

Tags

apilaravelrestkeep datalaravel-query-updater

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/latevaweb-laravel-query-updater/health.svg)

```
[![Health](https://phpackages.com/badges/latevaweb-laravel-query-updater/health.svg)](https://phpackages.com/packages/latevaweb-laravel-query-updater)
```

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)

PHPackages © 2026

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