Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Flattable Laravel Package

tkeer/flattable

tkeer/flattable flattens nested arrays and Laravel/Eloquent data into clean, single-level rows for HTML tables, CSV exports, and reports. It simplifies turning complex hierarchical structures into readable tabular output with minimal setup, making it useful for dashboards, exports, and data-heavy ad...

View on GitHub
Deep Wiki
Context7

It helps you manage de-normalized tables

Frequently asked questions about Flattable
What is tkeer/flattable used for in a Laravel application?
tkeer/flattable flattens nested arrays and Laravel/Eloquent data into clean, single-level rows for HTML tables, CSV exports, and reports. It targets reporting screens, dashboards, exports, and data-heavy admin lists where multi-table joins would otherwise be expensive. Under the hood it is a lightweight, in-app implementation of the read-model or materialized-view pattern: you keep a normalized write model and materialize a de-normalized flat table for reads.
How do I install tkeer/flattable in a Laravel project?
Install it with Composer (composer require tkeer/flattable) and let Laravel package auto-discovery register its service provider. From there you publish the config and use the package's generator commands to scaffold flat tables, following the README. Budget a half-day spike to wire it into an existing app; the real work is deciding which tables become projections and who owns the refresh schedule.
Which Laravel and PHP versions does tkeer/flattable support?
Check the declared constraints in composer.json before committing, because the package has a single maintainer, roughly 91 GitHub stars, and thin documentation. Packages in that position commonly lag Laravel major releases, so a constraint that pins you to Laravel 9 or 10 can block an upgrade six months out. Broad CI coverage across framework versions is not guaranteed, so verify the tested matrix yourself against your target Laravel and PHP versions.
Does tkeer/flattable support incremental or delta refresh, or only full rebuilds?
The refresh model is full truncate-and-reload driven by artisan commands, not delta sync. That single answer determines whether it survives past roughly one million rows, because a full rebuild creates locking and staleness windows on large tables. If you need sub-second freshness or incremental updates, plan to add your own delta logic or treat the package as the wrong layer.
Can source and target tables live on different database connections, such as a read replica?
The package's assumptions here are not clearly documented, so verify them against your infrastructure before relying on it. A projection written to a read replica will silently lose data, which is a common failure mode in apps that split reads and writes. Test it explicitly with separate connections and confirm both DDL generation and inserts target the primary.
Can flattable refresh run as a queued job instead of a synchronous artisan command?
Refresh is exposed through artisan commands, so queueing is your responsibility: wrap the command in a job or scheduled task and add an overlap lock so two rebuilds cannot collide. Watch timeouts and memory on large tables, and alert on failures, since built-in observability is limited. If you need events or logs to hook into, add them at the job level.
How should I test a tkeer/flattable projection in Laravel?
Refresh the flat table in your test setup, then assert row counts and column values against fixtures built from the normalized source. Add explicit schema assertions, because drift between source and projection fails quietly rather than loudly. Feature-test the read path behind a feature flag so you can prove rollback to the original query is a config change rather than a data operation.
Is tkeer/flattable safe for production with large tables?
It can be, provided you accept full-rebuild semantics and budget for the locking and staleness windows they create. The bigger risk is stewardship: at around 91 stars with one maintainer this is a bus-factor-one dependency that may lag Laravel releases and never ship a migration path. Add your own schema-drift assertions, monitor refresh duration, and keep the original query path available for rollback.
What happens if a source column is renamed or dropped?
Documentation is thin, and the likely behavior is a silent null or an omitted column rather than a hard failure, since the abstraction hides the generated SQL. Treat schema drift as an expected failure mode: assert that expected columns exist after each refresh and fail the job loudly. Review query plans periodically too, because hidden generated SQL makes performance regressions harder to spot.
What are alternatives to tkeer/flattable for de-normalized read models in Laravel?
On PostgreSQL, native materialized views with concurrent refresh deliver the same read optimization with better tooling and no extra dependency. You can also hand-roll projection tables refreshed by queued jobs or model events, which is more code but fully under your control. If the real need is cross-system analytics or sub-second search freshness, use a search index such as Laravel Scout or a dedicated analytics store rather than an in-app flat table.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo