{"id":33984980,"url":"https://github.com/anklimsk/cakephp-spreadsheet","last_synced_at":"2026-05-20T16:33:32.853Z","repository":{"id":56948499,"uuid":"143698900","full_name":"anklimsk/cakephp-spreadsheet","owner":"anklimsk","description":"Generate MS Excel files with the CakePHP","archived":false,"fork":false,"pushed_at":"2020-04-02T17:04:14.000Z","size":3922,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-14T16:54:12.125Z","etag":null,"topics":["cakephp-plugin","cakephp2","spreadsheet"],"latest_commit_sha":null,"homepage":"https://anklimsk.github.io/cakephp-spreadsheet","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/anklimsk.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}},"created_at":"2018-08-06T08:29:01.000Z","updated_at":"2020-04-02T17:01:13.000Z","dependencies_parsed_at":"2022-08-21T03:10:31.188Z","dependency_job_id":null,"html_url":"https://github.com/anklimsk/cakephp-spreadsheet","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/anklimsk/cakephp-spreadsheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-spreadsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-spreadsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-spreadsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-spreadsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anklimsk","download_url":"https://codeload.github.com/anklimsk/cakephp-spreadsheet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-spreadsheet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33267030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-20T15:12:43.734Z","status":"ssl_error","status_checked_at":"2026-05-20T15:12:42.300Z","response_time":356,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cakephp-plugin","cakephp2","spreadsheet"],"created_at":"2025-12-13T04:41:03.431Z","updated_at":"2026-05-20T16:33:32.847Z","avatar_url":"https://github.com/anklimsk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CakePHP 2.x Generate MS Excel files plugin\n[![Build Status](https://travis-ci.com/anklimsk/cakephp-spreadsheet.svg?branch=master)](https://travis-ci.com/anklimsk/cakephp-spreadsheet)\n[![Coverage Status](https://codecov.io/gh/anklimsk/cakephp-spreadsheet/branch/master/graph/badge.svg)](https://codecov.io/gh/anklimsk/cakephp-spreadsheet)\n[![Latest Stable Version](https://poser.pugx.org/anklimsk/cakephp-spreadsheet/version)](https://packagist.org/packages/anklimsk/cakephp-spreadsheet)\n[![License](https://poser.pugx.org/anklimsk/cakephp-spreadsheet/license)](https://packagist.org/packages/anklimsk/cakephp-spreadsheet)\n\nGenerate MS Excel files with the CakePHP\n\n## This plugin provides next features:\n\n- Generate MS Excel files\n\n## Installation\n\n1. Install the Plugin using composer: `composer require anklimsk/cakephp-spreadsheet`\n2. Add the next line to the end of the file `app/Config/bootstrap.php`:\n\n   ```php\n   CakePlugin::load('CakeSpreadsheet', ['bootstrap' =\u003e true, 'routes' =\u003e true]);\n   ```\n\n## Using this plugin\n\n1. In your `Model`:\n   - Create the following methods:\n\n      ```php\n      public function getExportConfig() {\n         $header = [__('Field label 1'), __('Field label 2'), __('Field label 3'), __('Field label 4')];\n         $width = [35, 20, 10, 15];\n         $align = ['L', 'L', 'C', 'R'];\n         $fileName = __('Export file');\n\n         return compact('header', 'width', 'align', 'fileName');\n      }\n\n      public function getExportData($conditions = []) {\n          ...\n          $result = [\n              'Group header (List name)' =\u003e [\n                  'Sub header' =\u003e [\n                      [\n                          'Field value 1',\n                          'Field value 2',\n                          'Field value 3',\n                          'Field value 4',\n                      ]\n                  ]\n              ]\n          ];\n\n          return $result;\n      }\n      ```\n\n2. In your `Controller`:\n   - Add the `RequestHandler` component to `AppController`, and map `xlsx` to \n     the CakeSpreadsheet plugin, e.g.:\n\n      ```php\n      public $components = [\n          ...,\n          'RequestHandler' =\u003e [\n              'viewClassMap' =\u003e [\n                  'xlsx' =\u003e 'CakeSpreadsheet.Spreadsheet'\n              ]\n          ]\n      ];\n      ```\n\n   - Add to your controller action:\n\n      ```php\n      public export($id = null) {\n         if (!$this-\u003eRequestHandler-\u003eprefers('xlsx')) {\n            throw new BadRequestException(__('Invalid export type');\n         }\n\n         $conditions = [];\n         if (!empty($id)) {\n            $conditions['Model.id'] = $id;\n         }\n         $exportConfig = $this-\u003eModel-\u003egetExportConfig();\n         $exportData = $this-\u003eModel-\u003egetExportData();\n\n         $this-\u003eset(compact('exportConfig', 'exportData'));\n      }\n      ```\n\n3. In your `View`:\n   - Create a link to the a action with the extension `.xlsx`, e.g.:\n\n      ```php\n      $this-\u003eHtml-\u003elink('Excel file', ['ext' =\u003e 'xlsx']);\n      ```\n\n   - Place the View templates in the subdirectory `Spreadsheet`, e.g.:\n     `app/View/Invoices/Spreadsheet/index.ctp`\n\n      ```php\n      if (isset($fileName)) {\n         $this-\u003esetFileName($fileName);\n      }\n\n      $this-\u003eSpreadsheet-\u003egetDefaultStyle()-\u003eapplyFromArray([\n         'font' =\u003e [\n            'name' =\u003e 'Arial Cyr',\n            'size' =\u003e 10,\n          ],\n      ]);\n      ```\n\n   - Use the `CakeSpreadsheet.exportExcelTable` element in your View file, e.g.:\n\n      ```php\n      echo $this-\u003eelement('CakeSpreadsheet.exportExcelTable', compact('exportConfig', 'exportData'));\n      ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanklimsk%2Fcakephp-spreadsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanklimsk%2Fcakephp-spreadsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanklimsk%2Fcakephp-spreadsheet/lists"}