- How do I install roundly-consulting/reports-for-laravel?
- Install it with Composer using composer require roundly-consulting/reports-for-laravel. The package follows standard Laravel package conventions and registers its service provider automatically through package discovery, so no manual provider registration is normally required. If the package ships a publishable configuration file, publish it with the vendor:publish command so you can tune defaults per environment.
- Which PHP and Laravel versions does Reports for Laravel support?
- The supported PHP and Laravel ranges are declared in the package's composer.json, so check that file before installing rather than relying on the release notes. Release 1.1.1 is a maintenance patch that only raises the minimum versions of its companion packages (package-toolkit, approvals, and enums) using caret constraints. Confirm the intersection of those requirements with your application's pinned PHP and Laravel versions before committing.
- How do I define a report with columns and headers?
- Reports are defined as reusable classes with a fluent API where you declare the columns, their headers, and the underlying data source. Because the definition lives in one place, you can reuse the same report across controllers, scheduled jobs, and views without duplicating query logic. This keeps your controllers and Eloquent models clean and gives you a consistent contract for every report in the application.
- Can I export report results to CSV?
- Yes. Export support is built in, with CSV as the primary format and room for other common formats through the same report definition. You define the columns and headers once, then run the report on demand and hand the output to the exporter rather than writing custom fputcsv loops. That keeps exported files consistent with what users see in the browser.
- Does Reports for Laravel work with Eloquent models and query builders?
- The package is designed for query-friendly integration, so a report's data source can be an Eloquent model or a query builder rather than a raw array. You keep using the familiar Laravel query API, including where clauses, relationships, and ordering, and the report layer handles collection and formatting. This means existing scopes and query logic can usually be reused inside a report definition.
- How do I render a report in a Blade view?
- The package ships Blade-ready views, so you can render a generated report directly in your templates instead of hand-writing table markup. You build the report in the controller, pass it to the view, and let the provided view handle the headers and rows. You can still override or customise the markup if your application needs a specific table layout.
- Do I need to publish a config file for Reports for Laravel?
- Configuration is Laravel-native through the package's service provider, and any publishable config is optional rather than mandatory for basic use. Publishing the config into config/ lets you adjust defaults such as export behaviour or view paths per environment. If you do not publish it, the package falls back to its own sensible defaults.
- How do I test reports in my Laravel application?
- Treat a report like any other application class: instantiate it in a feature test, run it against a test database or an in-memory SQLite connection, and assert on the returned rows and headers. The package's dependencies include an approvals library for snapshot-style assertions, which pairs well with asserting exact report output. Note that the testing dependency is dev-only, so it is not needed in production installs.
- Will Reports for Laravel conflict with my other Composer dependencies?
- The main risk with this package is dependency-graph risk rather than behaviour, because it hard-couples to the roundly companion suite (package-toolkit, approvals, and enums) with caret constraints. All constraints use caret ranges and 1.1.1 only raises lower bounds, so a project already on the previous minor line should update without code changes. Before rolling out, update in a feature branch and run composer why-not to surface any transitive conflicts.
- Is Reports for Laravel production-ready, and what are the alternatives?
- Release 1.1.1 is a routine maintenance release with no API changes, deprecations, or breaking changes, which suggests a stabilised 1.x surface, but no prior assessment or substantive source data is available to independently verify API coverage or test depth. Treat its capability claims as unverified until a short spike confirms them in your own application. If you only need spreadsheet exports, Laravel Excel or Spatie's packages are well-known alternatives, whereas this package is aimed at structured, reusable report definitions backed by Blade views.