Download the PHP package rishadblack/i-reports without Composer

On this page you can find all versions of the php package rishadblack/i-reports. 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 i-reports

rishadblack/i-reports

Paginated, filterable Laravel reports with a Livewire viewer and print, PDF, Excel and CSV export, all from one report class (a Blade view is optional).

Requires PHP 8.3+, Laravel 11, 12 or 13, Livewire 3 or 4, Bootstrap 5.3 CSS on the page that embeds the viewer.

Installation

Set the namespace and suffix so reports live in their own folder, and add auth when reports hold private data:

Quick start

This creates App\Livewire\Reports\UsersReport and a Pest test; the report renders through the package's default grid view. Embed the viewer anywhere:

Need custom markup? Copy the default view into the app and edit it — the report picks it up automatically because an existing view at the conventional path always wins over the package default:

The report class

The view

x-i-reports::rows renders every row and visible column in one component. For custom cell markup, loop with x-i-reports::tr and x-i-reports::td :column="$column" :row="$row" instead.

Full exports (print, PDF, Excel, CSV) raise the PHP memory and time limits to export_memory_limit and export_time_limit, and Laravel Debugbar is disabled on the report route.

Very large print and PDF (100k+ rows)

Above stream_threshold rows (default 5000), print and PDF no longer render your Blade view. They stream:

Per report: $this->setStreamThreshold(0) always streams, $this->setStreamThreshold(PHP_INT_MAX) always uses the view.

A custom view can still be split for mPDF the laravel-mpdf way. Put <x-i-reports::chunk /> between complete blocks (never inside a table); in PDF it prints the pdf_chunk_separator marker (<html-separator/>), the HTML is cut there, and each piece is written separately. In other outputs it renders nothing.

mPDF itself needs about 3 seconds per 1000 table rows, so a 100k-row PDF takes minutes. Enable queue.enabled so large PDFs are generated by ExportReportJob instead of the web request.

How it works

  1. The viewer encrypts its state (report, filters, search, sort, page, page size, export type and the row count) into a token that expires after token_ttl minutes and is bound to the signed-in user.
  2. GET /ireport/view?token=... resolves the token, checks authorize(), builds the query (joins for relation columns, filters, search, sort, selects, additionalQuery()) and renders the view in the iframe, or returns the export.
  3. Because the viewer already counted the rows, the iframe request runs no second COUNT.

Set viewer_mode to inline to render the table inside the Livewire component instead of an iframe. Sorting then works with wire:click and each interaction is one request.

Both modes follow Bootstrap 5.3's light and dark mode: the report reads the data-bs-theme of the page around it (the iframe also switches live when the page toggles it; opened on its own it follows the OS). On-screen cells use config('i-reports.screen_style'), whose --ir-* CSS variables change with the theme; print, PDF and Excel always use the fixed default_style. Set a screen_style key to null to use default_style on screen as well.

Report settings

All setters are called in configure().

Setter Purpose
setReportTitle(), setHeaderTitle() Page title and organisation name (PDF footer)
setDefaultSort($field, $direction) Sort used when the user has not chosen one. Qualify the column.
setPagination(), setPaginationList() Default and selectable page sizes
setSearchField(['relation.field', 'col->json']) Extra search fields besides searchable() columns
setAdditionalSelects() Extra addSelect expressions, for example aggregates read in map()
setPaperSize(), setOrientation() PDF page setup
setFileName(), setFileTitle() Download file name and PDF title
setHeaderView(), setPdfHeaderView(), setPdfFooterView() Blade views for the report header and the PDF page header/footer
setExcelMode('query'\|'view') Stream the query (default) or convert the Blade table
setGroupBy('column') Group rows for x-i-reports::grouped-tbody

Hooks you can override: authorize(), filters(), additionalQuery(), search(), map(), summaries(), additionalData().

Columns

Column::make('Title', 'field') or 'relation.field' for BelongsTo, HasOne and MorphOne relations (left-joined and aliased by the relation name).

Method Effect
searchable() Included in the search box
sortable() Can be sorted from the viewer. Non-sortable columns are rejected server side.
hide() Never selected or rendered
hideIn('pdf\|xlsx\|csv\|print\|view\|inline') Hidden in some outputs only
custom() Not selected from the database. Render it with format() or in the view.
format(fn ($value, $row, $column) => ...) Display transform. Escaped unless html() is called.
html() Print format() output raw.
exportFormat(fn ($value, $row) => ...) Value for CSV and Excel
style('css'), style(fn ($row) => 'css'), align(), width() Cell styling
number(), money('BDT'), date(), datetime(), boolean(), badge([...]), link(fn), image() Column types with display and export formatting
sum(), avg(), count(), min(), max() Aggregates over the filtered rows, shown by x-i-reports::aggregates and in exports

Because relation columns add joins, qualify base-table columns in filters, sorts and additionalQuery().

Filters

Filter::make('Title', 'key') renders in the viewer's filter dialog and applies through ->filter(fn (Builder $query, $value) => ...) or automatically on ->column('table.col').

Type Value Default constraint
text() string LIKE %value%
select([...]) string =
multiSelect([...]) array IN
date() Y-m-d whereDate =
dateRange() ['from' => ..., 'to' => ...] whereDate >= / <=
number(), numberRange() number / ['from', 'to'] = / >= <=
boolean() '1' or '0' =
component('livewire.name', [...]) from the component callback or column
bladeComponent('x-name', [...]) from the component callback or column

Values are sanitised by type before they reach the query. Invalid values are ignored. dependsOn('parent_key') re-mounts a component filter with the parent's value and clears it when the parent changes. default($value) pre-fills a filter.

Exports

Format How
CSV Streamed with fputcsv, BOM for Excel, formulas neutralised
Excel query mode streams the query in chunks through the column types; view mode converts the Blade table
PDF mpdf renders the Blade view with optional header/footer views and <x-i-reports::page-break />
Print Full page with window.print()

Queued exports: enable queue.enabled, set queue.threshold. Exports above the threshold are generated by ExportReportJob, stored on queue.disk, and ReportExportCompleted is dispatched.

From the console or the scheduler:

Direct links without the viewer:

Branded headers and footers

Every export carries the same branding:

Filters describe themselves in the header and the viewer's chips. For component filters whose values are ids, add ->displayUsing(fn ($id) => Country::find($id)?->name). Set header_view to replace the built-in header with your own Blade view.

Showing and hiding columns

The viewer has a Columns menu. Hidden columns are kept in the URL, in saved views and in the token, so the iframe and every export (print, PDF, Excel, CSV, background exports) leave them out.

Hidden columns are also removed from the SQL: their SELECT and, for relation columns, their JOIN are skipped, which keeps wide reports fast. A hidden column stays in the query only while the active search, sort or setGroupBy() needs it. If map(), another column's format() or a custom view reads a column's value, mark it ->alwaysSelect().

The model key is always selected (unless the query is grouped), so format() callbacks and links can use $row->id.

Background exports

With queue.enabled, an export whose row count reaches its format threshold runs in a queued job instead of the web request:

The viewer lists the user's recent exports with their status (queued, preparing, ready, failed), polls while any is pending, and shows a Download button when the file is ready. Downloads are only served to the user (or guest session) that requested them.

Setup: run php artisan migrate (creates i_reports_exports), keep a worker running (php artisan queue:work), and schedule php artisan i-reports:prune-exports daily to delete old files. ReportExportCompleted is dispatched for each finished export if you want to send a notification or email.

Live updates: polling or sockets (Reverb, Pusher, Ably)

queue.realtime decides how the viewer learns that an export changed status:

Mode Behaviour
poll (default) The viewer polls every poll_seconds while an export is pending. Nothing else to set up.
broadcast Each status change is pushed with ReportExportUpdated (a ShouldBroadcastNow event) on the private channel i-reports.exports.{userId}, as .report-export.updated. The viewer listens through Laravel Echo and updates instantly.

Broadcast mode falls back to polling by itself when the page has no window.Echo or the visitor is a guest (guests cannot join private channels), and keeps a slow safety poll (fallback_poll_seconds) in case a message is missed. A failing socket server is reported but never fails the export. The package registers the channel authorization: users only receive their own exports.

To use Laravel Reverb:

The viewer also dispatches i-reports:export-ready (id, format, url) and i-reports:export-failed browser events, so you can show your own toast:

Saved presets

Enable presets.enabled, publish and run the migration (--tag=i-reports.migrations). Signed-in users can save, apply and delete named filter sets per report from the viewer.

Registry

Reports resolve by convention. To map explicit names, or to list reports:

Security notes

Testing

License

MIT.


All versions of i-reports with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
livewire/livewire Version ^3.0|^4.0
maatwebsite/excel Version ^3.1|^4.0
mpdf/mpdf Version ^8.2
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 rishadblack/i-reports contains the following files

Loading the files please wait ...