aptcreativedesign/mongodb-laravel-livewire-tables
Integrates MongoDB with Livewire-powered tables in Laravel, letting you query, sort, and paginate MongoDB collections through a Livewire table component. Suited to Laravel apps already using MongoDB that want Livewire table UI without extra glue code.
What this package actually is. Not a table library, and not a MongoDB driver — it is a thin adaptation layer that maps rappasoft/laravel-livewire-tables column/filter/search/sort definitions onto mongodb/laravel-mongodb query builders. Its entire value is the translation of the relational assumptions baked into Livewire Tables (SQL LIKE, whereDate, id primary keys, OFFSET pagination) into BSON filter documents and aggregation stages. Everything that makes a table good — rendering, filtering UI, pagination controls — belongs to the upstream package.
Architecture fit. Good conceptual fit for a narrow, well-defined problem. The adapter pattern is the right shape: our product code extends a Mongo-aware base table component, keeps its own columns()/filters()/row formatting, and the bridge absorbs the dialect mismatch. It also composes cleanly with an app already running MongoDB behind Eloquent-style models. The concern is where the seam sits — if the bridge subclasses or overrides protected internals of Livewire Tables rather than public extension points, it inherits fragility from every upstream Livewire/Livewire Tables upgrade.
Integration feasibility. Feasible, but only as a deliberate, pinned, spiked integration — not a composer require and go. It is a four-package dependency chain (livewire/livewire, rappasoft/laravel-livewire-tables, mongodb/laravel-mongodb, this bridge) with a version compatibility matrix we do not know and cannot infer from the repository. The v1.02 → v4.0.0 jump with an empty release note (a changelog URL only) means we have zero documented upgrade contract. A 2–3 day spike on a throwaway branch, against a real collection of a few hundred documents, is the correct first spend, and it should produce a version-lock artifact rather than a demo.
Technical risk — highest to lowest:
rappasoft/laravel-livewire-tables, which itself has major versions and dropped Livewire 2-era APIs. Two linked upgrade cadences multiply maintenance windows.wire:key stability, row actions, and route model binding; Mongo type-ordering makes mixed/missing fields sort unpredictably; regex-based search turns user input metacharacters into over-matches or throws; BSON dates don't behave like MySQL dates under Carbon casts; skip/limit over an aggregation without a deterministic $sort silently duplicates or drops rows across pages. Each is a bug report from a user, not a compile error.Key questions to resolve in the spike:
composer.json — PHP, Laravel, Livewire, Livewire Tables, mongodb/laravel-mongodb?_id normalised to a string id, and is it stable enough for wire:key and row actions?$text against a text index? Is input escaped?skip/limit on a cursor, or an aggregation pipeline? Is a deterministic $sort enforced?Verdict. Adopt conditionally, as a scoped internal-tool accelerator. Justified when we already run Laravel + Livewire + MongoDB and need admin/reporting tables in weeks rather than months. Not justified for customer-facing, high-volume, or long-support-horizon surfaces, and not justified if the spike shows the bridge depends on upstream internals.
Stack fit gate. Three preconditions must all hold before any code is written: the data lives in MongoDB (not a SQL database we merely might migrate), the UI is Livewire-based, and the target screens are internal/admin/reporting. If any fails, the bridge adds a dependency without removing work. Mixed-storage apps are the intended case — point individual tables at Mongo-backed models while the rest of the app stays relational.
Migration path. Treat this as greenfield adoption on new screens, not a retrofit of existing SQL tables. The safe path is: new branch → install the pinned quartet → build one real table against a small collection → verify sort, global search, column search, filters, pagination stability across pages → then expand to a second table with a different data shape (embedded document, BSON date field). Only after both pass does it become the standard pattern for Mongo-backed admin screens. The v1.02 → v4.0.0 upgrade is explicitly not a drop-in: if any existing code depends on the old major, migration is a separate project with its own diff review of everything under src/.
Compatibility strategy. Pin exact versions in composer.json — not carets — for all four packages, and record the working set in the repo. Because the release notes are empty, source control is the changelog: diff src/ between tags before any bump, and check for changed signatures on every method we override. Any feature we need that's missing gets implemented as a subclass override, never a fork — forks of adapters die at the next upstream bump.
Sequencing (roughly 3–4 weeks end to end for a first wave):
composer.json and a written go/no-go.config/database.php, model $connection set, string id exposed from _id, datetime casts on date fields declared, _id-backed stable row keys._id/timestamp tiebreaker, filters written as closures returning the query builder, computed columns via $project/$addFields rather than selectRaw.$text index; exclude docs missing sort fields via $match; confirm pagination determinism; route export and bulk actions through the table's own builder so filters actually apply.Deliberate non-goals. No whereRaw, having, or SQL-style whereHas joins — those are dead ends, not workarounds; cross-collection needs become $lookup stages. No adoption on customer-facing screens without a separate performance validation. No unpinned installs in CI.
Maintenance and vendor risk. The real cost here is not the licence (MIT) but the ownership. With zero stars and a single maintainer, assume we are the long-term maintainers of our own fork. Budget a recurring, low-single-digit-percent engineering allocation per quarter for dependency tracking, and designate one named owner. The quarterly task is concrete: diff src/ against the newest tag, run the table test suite, re-pin. If the package goes quiet for two consecutive quarters, plan a fork-and-vendor decision rather than discovering it during a Laravel major upgrade.
Support. There is no support channel, no issue-history signal, and no docs beyond the description. Internal support therefore depends entirely on the ramp-up artifacts we write ourselves. The single most valuable investment is not code — it is a one-page internal guide covering the _id/id distinction, the search-escaping rule, the sort-tiebreaker rule, and the "dump the filter document before blaming the component" debugging step.
Scaling. The package's practical envelope is bounded by its Mongo idioms, not its own code. Regex-based search and skip/limit pagination are comfortable at tens of thousands of documents and degrade at millions. Before any table is exposed to more than internal staff, validate against production-scale data with a text index plus $text search and a deterministic $sort ahead of the slice. Aggregation pipelines with $lookup are the correct escape hatch but shift cost from the database's query planner to our code review.
Failure modes to instrument for. These fail quietly — empty tables and shuffled pages, not stack traces:
"5" vs int 5), not a component fault.$sort with a unique tiebreaker._id or a timestamp.wire:key collisions — ObjectId vs string id assumptions.Model::all() instead of the table builder.datetime casts; use whereBetween with Carbon instances, not whereDate.Instrument the two cheapest guards: enable mongodb/laravel-mongodb query logging in non-production, and add a smoke test per table that asserts row count and first-page ordering — that pair catches most of the list above before a user does.
Ramp-up. A Laravel/Livewire developer unfamiliar with Mongo needs roughly 2–4 days to become productive: half a day on the bridge's structure, the rest on BSON types, filter documents, and aggregation stages. The SQL-muscle-memory traps (id, LIKE, whereDate, joins) are the actual learning curve, not the package API. Plan for one engineer to become the named owner and to write the internal guide — that engineer's ramp-up is the organisation's, since there is no external documentation to fall back on.
How can I help you explore Laravel packages today?