{"id":22491803,"url":"https://github.com/always-open/report-engine","last_synced_at":"2025-08-03T00:31:15.122Z","repository":{"id":43006559,"uuid":"377930652","full_name":"always-open/report-engine","owner":"always-open","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-18T19:16:17.000Z","size":145,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"3.x","last_synced_at":"2024-11-24T19:20:40.490Z","etag":null,"topics":["hacktoberfest","laravel","reporting","reports"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/always-open.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null},"funding":{"github":"always-open"}},"created_at":"2021-06-17T18:46:23.000Z","updated_at":"2023-01-20T11:33:03.000Z","dependencies_parsed_at":"2022-08-23T05:20:19.345Z","dependency_job_id":null,"html_url":"https://github.com/always-open/report-engine","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/always-open%2Freport-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/always-open%2Freport-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/always-open%2Freport-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/always-open%2Freport-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/always-open","download_url":"https://codeload.github.com/always-open/report-engine/tar.gz/refs/heads/3.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228508031,"owners_count":17931263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","laravel","reporting","reports"],"created_at":"2024-12-06T18:11:15.815Z","updated_at":"2024-12-06T18:11:16.543Z","avatar_url":"https://github.com/always-open.png","language":"PHP","funding_links":["https://github.com/sponsors/always-open"],"categories":[],"sub_categories":[],"readme":"# General reporting engine for Laravel\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/always-open/report-engine.svg?style=flat-square)](https://packagist.org/packages/always-open/report-engine)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/always-open/report-engine/run-tests?label=tests)](https://github.com/always-open/report-engine/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/always-open/report-engine/Check%20\u0026%20fix%20styling?label=code%20style)](https://github.com/always-open/report-engine/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/always-open/report-engine.svg?style=flat-square)](https://packagist.org/packages/always-open/report-engine)\n\nGeneral reporting engine for Laravel\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require always-open/report-engine\n```\n\n## Usage\n\n### Create a report\n\nCreate a report that extends the ReportBase. Within this class you will define the query to fetch the data as well as \nthe columns which will be output.\n\n```php\n\u003c?php\n\nnamespace App\\Reports\\User;\n\nuse App\\Models\\User;\nuse AlwaysOpen\\ReportEngine\\BaseFeatures\\Data\\Types\\Text;\nuse AlwaysOpen\\ReportEngine\\ReportBase;\nuse Illuminate\\Database\\Query\\Builder;\n\nclass UserReport extends ReportBase\n{\n    protected $autoloadInitialData = true;\n\n    /**\n     * @return string\n     */\n    public function title(): string\n    {\n        return 'User Maintenance';\n    }\n\n    /**\n     * @return string\n     */\n    public function description(): string\n    {\n        return 'List of all users within the system';\n    }\n\n    /**\n     * @return Builder\n     */\n    public function baseQuery(): Builder\n    {\n        return User::toBase()\n            -\u003eselect([\n                'id',\n                'email',\n                'name',\n            ]);\n    }\n\n    /**\n     * @return array\n     */\n    public function availableColumns(): array\n    {\n        return [\n            'name' =\u003e [\n                'label'      =\u003e 'Name',\n                'filterable' =\u003e true,\n                'type'       =\u003e new Text(),\n            ],\n            'email' =\u003e [\n                'label'      =\u003e 'Email',\n                'filterable' =\u003e true,\n                'type'       =\u003e new Text(),\n            ],\n        ];\n    }\n}\n\n```\n\n### Create a controller\n\nCreate a controller to output the report\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Reports\\User\\UserReport;\n\nclass UserController extends Controller\n{\n    /**\n     * @return UserReport\n     */\n    public function index() : UserReport\n    {\n        return app(UserReport::class);\n    }\n}\n```\n\n### Create a route\n\nWhen creating a route ensure you include `multiformat` as this will handle things like `.sql` and `.json` endpoint calls.\n\n```php\n\u003c?php\n\nuse App\\Http\\Controllers\\UserController;\n\nRoute::get('users', [UserController::class, 'index'])\n    -\u003emultiformat();\n```\n\n#### Routes\n\nMultiformat adds handling multiple formats to the url which can give the following output building upon the above \nexamples.\n\nThis will output an HTML page that will contain a tabulator table and make ajax requests to get the data needed.\n```\n{{ base_url }}/users\n```\n\nThis will output a JSON payload of the data\n```\n{{ base_url }}/users.json\n```\n\nThis will output the entire SQL query, useful for debugging\n```\n{{ base_url }}/users.sql\n```\n\nThis will return the output of the explain command for the query, useful for debugging\n```\n{{ base_url }}/users.explain\n```\n\n## Filters\nHere are the possible filters for the default types. To build a filter follow this format:\n```javascript\nlet filterParams = new URLSearchParams();\nlet filterName = 'name'\nlet action = 'equals'\nlet value = 'bob'\nfilterParams.append('filters['+filterName+']['+action+']', value)\n```\n\n### DateTime\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### Decimal\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### Dollar\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### Enum\n- equals\n\n### Html\n- contains\n- does_not_contain\n\n### Integer\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### NullableDecimal\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- is_empty\n- is_not_empty\n- less_than\n- less_than_or_equal\n\n### NullableInteger\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- is_empty\n- is_not_empty\n- less_than\n- less_than_or_equal\n\n### Number\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### NumericHtml\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### Percentage\n- does_not_equal\n- equals\n- greater_than\n- greater_than_or_equal\n- less_than\n- less_than_or_equal\n\n### Text\n- contains\n- does_not_contain\n- does_not_equal\n- equals\n\n### Url\n- contains\n- does_not_contain\n\n### YesNo\n- is_true\n- is_false\n\n### YesNoShort\n- is_true\n- is_false\n\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [AlwaysOpen](https://github.com/always-open)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falways-open%2Freport-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falways-open%2Freport-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falways-open%2Freport-engine/lists"}