{"id":30252070,"url":"https://github.com/koolreport/examples-codeigniter4","last_synced_at":"2025-08-15T11:10:17.163Z","repository":{"id":299787566,"uuid":"988917452","full_name":"koolreport/examples-codeigniter4","owner":"koolreport","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-18T09:08:12.000Z","size":4730,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-18T10:19:52.029Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"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/koolreport.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-23T09:18:10.000Z","updated_at":"2025-06-18T09:08:16.000Z","dependencies_parsed_at":"2025-06-18T10:30:00.799Z","dependency_job_id":null,"html_url":"https://github.com/koolreport/examples-codeigniter4","commit_stats":null,"previous_names":["koolreport/examples-codeigniter4"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/koolreport/examples-codeigniter4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koolreport%2Fexamples-codeigniter4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koolreport%2Fexamples-codeigniter4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koolreport%2Fexamples-codeigniter4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koolreport%2Fexamples-codeigniter4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koolreport","download_url":"https://codeload.github.com/koolreport/examples-codeigniter4/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koolreport%2Fexamples-codeigniter4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270558906,"owners_count":24606612,"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-08-15T02:00:12.559Z","response_time":110,"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":[],"created_at":"2025-08-15T11:10:12.639Z","updated_at":"2025-08-15T11:10:17.151Z","avatar_url":"https://github.com/koolreport.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KoolReport in CodeIgniter\n\nCodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.\nMore information can be found at the [official site](https://codeigniter.com).\n\nKoolReport is reporting framework and can be integrated into Laravel or any other MVC framework. KoolReport help you to create data report faster and easier.\n\nIn this repository, we would like to demonstrate how KoolReport can be used in Laravel.\n\n# Installation\n\nRun `composer` command in your Laravel directory to install `koolreport/core` and `koolreport/codeigniter4`\n\n```\ncomposer require koolreport/core\ncomposer require koolreport/codeigniter4\n```\nor install `koolreport/pro` if you have a license for it\n\n```\ncomposer require koolreport/pro\n```\n\n# Create reports using friendship trait for setting up assets and datasources\n\n1. Inside `app` directory, create `reports` subdirectory to hold your reports.\n2. Create `MyReport.php` and `MyReport.view.php` inside `reports` directory. Assign `App\\reports` namespace for the report if you want it can be autoloaded. Otherwise, you could load the report directly in your controller when using it. Please see the contents of two files in our repository.\n3. Add \\koolreport\\laravel\\Friendship trait to your report like following:\n\n```\nclass MyReport extends \\koolreport\\KoolReport\n{\n    use \\koolreport\\codeigniter4\\Friendship;\n    ...\n```\nThis trait would help the report to publish js, css assets to Laravel's `public` directory in a subdirectory called `asset/koolreport_assets` as well as allow using Laravel's database settings in the report.\n\n## Create route and action\n\nIn `app/Config/routes.php`, create a route to your report and its action with a controller:\n\n```\n$routes-\u003eget('/customReport', 'Home::customReport');\n```\n\nIn the `Home` controller (`app/Controllers/Home.php`), create the action method:\n\n```\n\tpublic function customReport()\n\t{\n\t\t$report = new \\App\\reports\\MyReport();\n\t\t$report_content = $report-\u003erun()-\u003erender(true);\n\t\treturn view(\"customReport\", [\"report_content\" =\u003e $report_content]);\n\t}\n```\nCreate the report view `app/views/customReport.php` and put your report content anywhere you like:\n\n```\n\u003chtml\u003e\n...\n\u003c?php echo $report_content; ?\u003e\n\u003c/html\u003e\n```\n\nAll done!\n\n## View result\n\nPut your CodeIgniter app on your server/localhost. Then you can access after running\n\n```\nhttp://locahost/examples-codeigniter4/public/customReport\n```\n\n![combochart](combochart.png)\n\n\n## CSRF field/token in form submissions and xhr requests\n\nIn case you enable csrf security for your app, in reports with form submission or xhr request users need to add csrf field/token to the form and request for server response to work.\n\nFor example, adding csrf field to form:\n\n```\n    \u003cform method=\"post\"\u003e\n        \u003c?php echo csrf_field(); ?\u003e\n```\nor add csrf token to request:\n\n```\n    \u003cscript\u003e\n        subReport.update(\"SaleByCountriesReport\", {\n            \u003c?php echo csrf_token(); ?\u003e: '\u003c?php echo csrf_token(); ?\u003e'\n        });\n```\n\n# Summary\n\nKoolReport is a great php reporting framework. You can use KoolReport alone with pure php or inside any modern MVC frameworks like Laravel, CakePHP, CodeIgniter, Yii2. If you have any questions regarding KoolReport, free free to contact us at [our forum](https://www.koolreport.com/forum/topics) or email to [support@koolreport.com](mailto:support@koolreport.com).\n\n__Happy Reporting!__","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoolreport%2Fexamples-codeigniter4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoolreport%2Fexamples-codeigniter4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoolreport%2Fexamples-codeigniter4/lists"}