Download the PHP package internetguru/laravel-model-browser without Composer

On this page you can find all versions of the php package internetguru/laravel-model-browser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-model-browser

Laravel Model Browser

A Laravel package to browse models and show them in cards, tables, etc.

Branch Status Code Coverage
Main tests coverage

Requirements

Livewire 3 → 4: As of version 4.3, this package requires Livewire 4. Support for Livewire 3 (and Laravel 9/10) has been dropped. The components are class-based and registered by the package's service provider, so no application changes are needed beyond upgrading Livewire itself.

Installation

  1. Install the package via Composer:

  2. Optionally publish the config, views, and translations:

Run Tests Locally

To run the tests manually, you can use the following command:

Basic Usage

Show the model browser in your views:

If no viewAttributes are provided, the model's fillable attributes are used by default.

Component Parameters

Both BaseModelBrowser and TableModelBrowser accept the following parameters:

model (required)

The Eloquent model class. Optionally specify a method (scope) to call on the model:

viewAttributes

Attributes displayed as columns/cards, mapped to their labels:

exportAttributes

Attributes included in the CSV export, mapped to their labels. They are hidden in the table and follow the viewAttributes columns, in the order given here. An entry whose key is also a view attribute is exported once, in its exportAttributes position — so a hidden column can be exported next to the visible one it belongs with:

The export above has three columns: created_at, customer.name, customer.email.

Only attributes with a single value per row belong here: own columns, or dot paths over to-one relations. A to-many relation has no single value to put in a cell. formats are irrelevant for these columns (nothing renders them); rawFormats apply as usual. Eager-load the relations they reach through via with to avoid an N+1 query per exported row.

formats

Formatting functions for attribute values. Each function receives ($value, $item) and returns the formatted output (HTML is allowed). Values are passed as global function name strings:

Define the formatting functions as global helpers, e.g. in a helpers.php file:

A related model as the value

A column may name a to-one relation itself, such as 'author' or 'payment.user'. Its value is then the related model, so one pair of functions serves every column holding the same kind of model, whichever relation it comes through:

Give such a column both functions: without them, the table and the export would show the model as JSON. The statistics count each related model as one value and show it through formats. Eager-load the relation.

alignments

Column alignment settings (start, end, or center). Numeric values default to end, others to start:

defaultSortColumn / defaultSortDirection

Default sort when user hasn't selected one:

enableSort

Enable/disable interactive column sorting (default: true):

filters / filterSessionKey

See the Filters section below. When using filters, filterSessionKey is required.

refreshInterval

Check interval in seconds. When set, the list checks its rows and total count on laravel-common's shared watch clock and re-renders only when something changed, so an idle list is left untouched. The clock waits longer while the tab is hidden and checks at once when it is shown again. Default: 0 (disabled):

exportName

The start of a CSV export's file name, followed by the time of the export in the display timezone: vouchers-2026-09-27-1430.csv. Defaults to the model's plural in kebab case (order-items); set it when the list is not simply its model, such as a summary over another one. The filter is not part of the name:

exportLimit

Maximum number of rows a CSV export may contain. When the current (filtered) result count exceeds the limit, the download button is disabled and the export endpoint refuses the request. Defaults to the model-browser.export_limit config value (1500). Set to 0 for unlimited:

statsAttributes / statsTextAttributes / title / statsLimit

Columns that are summarized, in the table only: their header offers the statistics menu. Every view attribute by default; name some to summarize only those, or pass [] to turn the statistics off. See Column Statistics:

A column counts as numeric when every value it has is a number, digits in a string included. statsTextAttributes names the columns whose values only look like numbers, such as order numbers; they get no numeric statistics:

title names the list as its page does, e.g. :title="__('order.list')"; each menu is headed "Orders / Amount", and a copy of it too. Without it, the heading is just the column's name.

statsLimit is the largest result count the statistics are computed for. Summarizing walks the whole filtered result set, so above it nothing is computed and the menu asks for narrower filters instead. Defaults to the model-browser.stats_limit config value (5000); set to 0 for unlimited.

TableModelBrowser-only Parameters

lightDarkStep

Controls alternating row shading in the table (default: 1):

columnWidths

Custom CSS grid column widths per attribute. Defaults to minmax(4em, 1fr):

Filters

The filter system provides a search bar with Gmail-style query syntax and an expandable filter panel. The active filter lives in the q URL query parameter (see Filter State in the URL), is persisted in the session, and can additionally be initialized from per-filter URL query parameters.

Configuration

Pass an associative array to the filters parameter. Each key is a filter name in kebab case (e.g. created-by), and each value is a config array:

Note that price has no column key — it is not auto-applied and must be handled manually in the model scope (see HasModelBrowserFilters Trait).

Filter Config Keys

Key Description
type Filter type: string, number, date, options, checkbox (default: string). number and date take a range (see HasModelBrowserFilters Trait).
label Display label in the filter panel
column Database column name for auto-apply. When set, the filter is automatically applied to the query. When omitted (and no columns), the filter is NOT auto-applied — use HasModelBrowserFilters trait for manual access.
columns OR group — a list of columns matched with OR instead of a single column (see OR Column Groups)
relation Eloquent relation name — wraps the filter in whereHas(). Supports dot-notation for nested relations.
options Array of options for the options type (e.g. ['value' => 'Label'])
rules Custom Laravel validation rules (overrides default type-based rules)
url URL query parameter name to initialize the filter from (takes priority over session)
timezone Timezone for date filters — the parsed date value is shifted via Carbon::shiftTimezone($tz) (e.g. 'Europe/Prague')

OR Column Groups

A single filter can match against several columns at once. Use columns instead of column — the filter's value matches when any of the listed columns matches, while the filter as a whole is still AND'd with every other term.

The typical case is collapsing a name + e-mail pair into one input:

customer:novak then matches customers whose name or e-mail contains novak, and the filter panel shows one input instead of two.

Each columns entry is either a plain column name or an array overriding column, relation, preprocessor, ascii_fast, type or timezone for that column only. Anything not overridden falls back to the filter's own config, so the shared relation above applies to both columns. Columns may also live in different relations:

All columns of an OR group also take part in free-text search, exactly as separate column filters would.

Ranges

A number or date filter takes a range, its bounds separated by ..:

A date bound stands for the whole period it names. The lower bound is the period's first moment and the upper bound its last, so a single value covers the whole period:

Relative bounds are anything Carbon::parse() reads (in English), and they span the unit they name: day, week, month, year, hour or minute; today, yesterday and tomorrow are days. Dates are read in the filter's timezone. Each bound is validated on its own against the filter's rules, and a date bound that is not a date is an error.

Both bounds must hold for the same related row, and for the same column of an OR group: with published:2026-03-01..2026-03-31 over posts.published_at, a user with one post before the range and another after it is not listed.

In the filter panel, filters are listed one under another, and a range filter shows two inputs side by side, one for each bound, which are joined into the one value. A date input shows the first or the last day of a bound's period; a bound left untouched keeps what was written, such as 2026-10 or 3 days ago.

Search Query Syntax

The search bar supports Gmail-style syntax:

Searching for rows with no value

A bare attribute:, followed by a space or the end of the query, matches the rows where the filter has nothing to match on: a column that is NULL or empty, and, for a filter over a relation, a row whose relation is missing altogether. With an OR group of columns, a row qualifies only when none of them carries a value. attribute:"" reads the same, and the query built from the filter panel writes the bare form.

A bare key that is no configured filter, such as note:, stays free text, and so does an unfinished name:"Jo. In the filter panel, type "" into a text field to search for no value.

Auto-applied vs Manual Filters

Filters with a column key are auto-applied to the Eloquent query. Filters without column are stored in session but require manual application — useful for custom logic in model scopes:

Typical reasons to omit column and handle filtering manually:

HasModelBrowserFilters Trait

Use this trait in your Eloquent model to access filter values from session for manual filtering. The $modelBrowserFilterSessionKey must match the filterSessionKey passed to the component.

Available methods:

URL-based Filter Initialization

Filters with a url key can be initialized from URL query parameters. When any URL filter is present, session-stored filters are ignored and URL values take priority:

Link: /orders?filter-status=active

The URL parameters are automatically cleaned from the browser address bar after initialization — the resulting filter is then carried by the q parameter like any other.

Filter State in the URL

The whole search query is mirrored into the q query parameter, so the current filter is part of the URL:

Priority on mount is: per-filter url parameters > q > session. When q is present it fully describes the filter state, so session values are never merged into it — otherwise navigating back would resurrect cleared filters.

Full Example

Below is a complete example of an order browser with auto-applied and manual filters:

In this example:

Features

Column Statistics

Every column in statsAttributes (all of them by default) carries an icon at the right edge of its header opening a menu of statistics. It takes no room from the column's name, so a narrow column does not break the name mid-word, and it sits in a box of a fixed size, because FontAwesome replaces its <i> with an <svg> only after the page has been laid out. The menu is kept within the visible part of the screen, and headed by the list's title and the column's name. Its first part applies to every column:

Statistic
DISTINCT Different values
EMPTY Empty values, and their share of the rows
NON-EMPTY Filled values, and their share of the rows
EARLIEST / LATEST First / last moment, when every value is a date

A numeric column adds:

Statistic
SUM Total of the column's numbers
AVG SUM over COUNT
MEDIAN Middle number, zeros included
MIN / MAX Smallest / largest number, zeros included
COUNT Values, zeros included
AVGNZ SUM over COUNTNZ
MEDIANNZ Middle number that is not zero
MINNZ / MAXNZ Smallest / largest number that is not zero
COUNTNZ Values that are not zero

An empty value (null or '') is no value at all: every statistic but EMPTY leaves it out, as SQL's AVG(column) and COUNT(column) do. A zero or false is a value. So COUNT less COUNTNZ is the number of zeros. A column whose empty value means zero, and should count as one, has to say so in its summary query (e.g. COALESCE(credit, 0)).

The labels are translated (model-browser::global.stats.labels): in Czech RŮZNÉ, SOUČET, PRŮMĚR and so on. A date span and SUM take the share's column too.

A line divides the groups (BaseModelBrowser::STATS_GROUPS): the ones above, the span of a date column, SUM, which zeros never change, and the statistics counting the zeros, each with its non-zero counterpart beside it (AVG with AVGNZ and so on). A header row names those two columns Non-empty and Non-zero. When a numeric column has no zero, the counterparts would only repeat the rest: the header row reads "No zero values." across the whole row instead, and each value takes both value columns. A column that is not numeric shows none of the numeric groups, COUNT included.

Below them come the column's ten most frequent values with their count and share of the rows, the most frequent first and ties in the order of the value, and a last row counting the rest ("… 77 other"). A date counts as its day in the display timezone. The values are aligned as their column is in the table: right for a numeric one, unless alignments says otherwise. A value is shown through the column's formats callback, called with the first row it came from, so a formatter can link it; without one, a labelled enum shows its label and a boolean Yes or No. Instead of the list, a note says when there are no values, when all of them are unique, when they are long texts (over 50 characters on average), or too many or of a kind that cannot be counted. A [copy] button under the menu puts all of it on the clipboard as tab-separated lines, as it is shown.

Values are read straight off the model, so they are in the attribute's own unit — formats and rawFormats are display concerns and are not applied while summarizing. The numeric statistics are then rendered through the column's formats callback, which is therefore called with an aggregate and no row ($format($value, null)); one that needs the row it came from falls back to a plain number. The counts are never formatted.

The statistics load when a menu is first opened, with a spinner in the meantime, and then colour every column's icon blue. A list no longer than the model-browser.stats_auto_limit config value (500; 0 turns it off) has them loaded right after its count instead. Every column is summarized in the one pass over the rows. The statistics are kept, also server side, across page changes and sorting, and are discarded when the filters change. Relations the query eager loads, through with or in the model's summary method, are loaded in chunks rather than row by row. Above statsLimit rows none are computed, the icon turns light grey, and the menu reads "To show stats, reduce results below 5,000 using filters."

The statistics are a table feature: the card view (base-model-browser) has no header to carry them.

License & Commercial Terms

License

Copyright © 2026 Internet Guru

This software is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.

Disclaimer: This software is provided "as is", without warranty of any kind, express or implied. In no event shall the authors or copyright holders be liable for any claim, damages or other liability.

Commercial Use

The standard CC BY-NC-SA license prohibits commercial use. If you wish to use this software in a commercial environment or product, we offer flexible commercial licenses tailored to:

Note: In many instances (especially for startups or small-scale tools), this may result in no fees being charged at all. Please contact us to obtain written permission or a commercial agreement.

Contact for Licensing: [email protected]

Professional Services

Are you looking to get the most out of this project? We are available for:

Reach out to us at [email protected] — we are more than happy to assist you!


All versions of laravel-model-browser with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
livewire/livewire Version ^4.0
laravel/framework Version ^13.0
internetguru/laravel-common Version ^9.1 || ^10
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package internetguru/laravel-model-browser contains the following files

Loading the files please wait ...