{"id":33994422,"url":"https://github.com/langleyfoxall/eloquent-report-generator","last_synced_at":"2025-12-13T07:54:20.651Z","repository":{"id":57011162,"uuid":"159809664","full_name":"langleyfoxall/eloquent-report-generator","owner":"langleyfoxall","description":"Generates reports from Eloquent models in many formats, such as CSV, PDF, Markdown, and HTML.","archived":false,"fork":false,"pushed_at":"2023-09-11T08:18:46.000Z","size":28,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-04T22:08:20.710Z","etag":null,"topics":["csv","eloquent","eloquent-models","html","markdown","pdf","reporting"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/langleyfoxall/eloquent-report-generator","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/langleyfoxall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-30T10:48:09.000Z","updated_at":"2023-08-23T09:42:07.000Z","dependencies_parsed_at":"2022-08-21T13:40:44.917Z","dependency_job_id":null,"html_url":"https://github.com/langleyfoxall/eloquent-report-generator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/langleyfoxall/eloquent-report-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langleyfoxall%2Feloquent-report-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langleyfoxall%2Feloquent-report-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langleyfoxall%2Feloquent-report-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langleyfoxall%2Feloquent-report-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/langleyfoxall","download_url":"https://codeload.github.com/langleyfoxall/eloquent-report-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langleyfoxall%2Feloquent-report-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27702251,"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","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csv","eloquent","eloquent-models","html","markdown","pdf","reporting"],"created_at":"2025-12-13T07:54:19.538Z","updated_at":"2025-12-13T07:54:20.643Z","avatar_url":"https://github.com/langleyfoxall.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eloquent Report Generator\n\nThis package can be used to generate reports from Eloquent models \nin many formats, such as CSV, PDF, Markdown, and HTML.\n\n## Installation\n\nTo install, just run the following composer command.\n\n```bash\ncomposer require langleyfoxall/eloquent-report-generator\n```\n\nRemember to include the `vendor/autoload.php` file if your framework \ndoes not do this for you.\n\n## Usage\n\nFirst, add the `Reportable` trait to the model or models you wish to\ncreate reports from.\n\n```php\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse LangleyFoxall\\EloquentReportGenerator\\Traits\\Reportable;\n\nclass User extends Model\n{\n    use Reportable;\n    \n    // ...\n```\n\nYou can then generate reports elsewhere in your application by calling the static `generateReport` method from this trait.\n\nSee the following code snippet for example usage.\n\n```php\n// Report format\n$format = (new CsvReportFormat());\n//$format = (new PdfReportFormat());\n//$format = (new MarkdownReportFormat());\n//$format = (new HtmlReportFormat());\n\n// Report generation\nUser::generateReport()\n    -\u003eformat($format)\n    -\u003equery(function ($query) {\n        // Restrict the records used in the report\n        $query-\u003ewhere('created_at', '\u003e=' '2018-01-01');  \n    })\n    -\u003efields(['email', 'name', 'created_at'])\n    -\u003efieldMap([\n        // Change how fields appear in the report\n        'email' =\u003e 'Email address',\n        'name' =\u003e 'Name',\n        'created_at' =\u003e 'Joined Date',\n    ])\n    -\u003edataRowManipulator(function (DataRow $dataRow) {\n        // Format the 'name' field\n        $name = $dataRow-\u003egetDataItemByFieldName('name');\n        $name-\u003evalue = ucwords($name);\n    }\n    -\u003esave(storage_path('app/report.csv'));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flangleyfoxall%2Feloquent-report-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flangleyfoxall%2Feloquent-report-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flangleyfoxall%2Feloquent-report-generator/lists"}