PHPackages                             giginc/cakephp3-driver-csv - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. giginc/cakephp3-driver-csv

ActiveCakephp-plugin[PDF &amp; Document Generation](/categories/documents)

giginc/cakephp3-driver-csv
==========================

An CSV datasource for CakePHP 3.5

v1.0.9(5y ago)2341↓72.7%MITPHPPHP ^5.6|^7.0CI failing

Since Feb 19Pushed 5y ago4 watchersCompare

[ Source](https://github.com/giginc/cakephp3-driver-csv)[ Packagist](https://packagist.org/packages/giginc/cakephp3-driver-csv)[ RSS](/packages/giginc-cakephp3-driver-csv/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (5)Versions (11)Used By (0)

Csv Driver for Cakephp3
=======================

[](#csv-driver-for-cakephp3)

An Csv datasource for CakePHP 3.5,3.6,3.7

Installing via composer
-----------------------

[](#installing-via-composer)

Install [composer](http://getcomposer.org) and run:

```
composer require giginc/cakephp3-driver-csv
```

Defining a connection
---------------------

[](#defining-a-connection)

Now, you need to set the connection in your config/app.php file:

```
 'Datasources' => [
...

    'csv' => [
        'className' => 'Giginc\Csv\Database\Connection',
        'driver' => 'Giginc\Csv\Database\Driver\Csv',
        'baseDir' => './', // local path on the server relative to CONFIG
    ],
],
```

Models
------

[](#models)

After that, you need to load Giginc\\Csv\\ORM\\Table in your tables class:

```
//src/Model/Table/ProductsTable.php
namespace App\Model\Table;

use Giginc\Csv\ORM\Table;

class ProductsTable extends Table
{

    /**
     * Initialize method
     *
     * @param array $config The configuration for the Table.
     * @return void
     */
    public function initialize(array $config)
    {
        parent::initialize($config);

        $this->setPrimaryKey('id');
        $this->setSchemaRow(1);      // Schema row is 1 row.
        $this->setDelimiter(',');    // default ,
        $this->setEnclosure('"');    // default "
        $this->setEscape("\\");      // default \\
        $this->setTable('products'); // load file is CONFIG/materials.csv
    }

    /**
     * Returns the database connection name to use by default.
     *
     * @return string
     */
    public static function defaultConnectionName()
    {
        return 'csv';
    }

    /**
     * findOk
     *
     * @param \League\Csv\Statement $query Query.
     * @param array $options Option.
     * @access public
     * @return \Cake\ORM\Query
     */
    public function findOk($query, array $options)
    {
        $query = $query
            ->where(function(array $row) {
                return $row['status'] == 'ok';
            });

        return $query;
    }
}
```

Controllers
-----------

[](#controllers)

```
namespace App\Controller;

use App\Controller\AppController;

/**
 * Pages Controller
 *
 * @property \App\Model\Table\PagesTable $Pages
 *
 * @method \App\Model\Entity\Review[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
 */
class PagesController extends AppController
{
    /**
     * Index method
     *
     * @access public
     * @return \Cake\Http\Response|void
     */
    public function index()
    {
        $this->loadModel('Products');
        $data = $this->Products->find();
    }

    /**
     * View method
     *
     * @param mixed $id
     * @access public
     * @return \Cake\Http\Response|void
     */
    public function view($id)
    {
        $this->loadModel('Products');
        $data = $this->Products->get(1);
    }

}
```

Let's see a quick example:

```
//config/products.csv
id,category,name,price
1,"iphone","iPhone",8000
2,"macbook_pro","Macbook Pro",150000
3,"redmi_3s","Redmi 3S Prime",12000
4,"redmi_4x":"Redmi 4X",15000
5,"macbook_air":"Macbook Air",110000
6,"macbook_air":"Macbook Air 1",81000
```

LICENSE
-------

[](#license)

[The MIT License (MIT) Copyright (c) 2020](http://opensource.org/licenses/MIT)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~49 days

Total

10

Last Release

2085d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.6

v1.0.8PHP ^5.6|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6e6faaa4785c7f5812464198b2503a25975f08e8c5a6239c33dc023dd272ab0?d=identicon)[issys16](/maintainers/issys16)

![](https://avatars.githubusercontent.com/u/3604122?v=4)[kgw](/maintainers/kgw)[@KGW](https://github.com/KGW)

![](https://www.gravatar.com/avatar/7949227b7010f17463abac769d717a9fb16d1b81e0b584b2ec5f399369a96cb3?d=identicon)[moimoi](/maintainers/moimoi)

---

Top Contributors

[![kgws](https://avatars.githubusercontent.com/u/83611?v=4)](https://github.com/kgws "kgws (22 commits)")

---

Tags

cakephpcsvcakephp-plugin

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/giginc-cakephp3-driver-csv/health.svg)

```
[![Health](https://phpackages.com/badges/giginc-cakephp3-driver-csv/health.svg)](https://phpackages.com/packages/giginc-cakephp3-driver-csv)
```

###  Alternatives

[soapbox/laravel-formatter

A formatting library that converts data output between XML, CSV, JSON, TXT, YAML and a few others.

2501.1M12](/packages/soapbox-laravel-formatter)[satthi/csv-combine-plugin-for-cakephp

CakePHP CsvCombine

1686.0k](/packages/satthi-csv-combine-plugin-for-cakephp)[silverstripe/gridfieldqueuedexport

Export large data sets from your GridField in the SilverStripe CMS interface through async jobs

10213.1k5](/packages/silverstripe-gridfieldqueuedexport)[dakota/cake-excel

CakePHP excel generator

2324.9k](/packages/dakota-cake-excel)[jbzoo/csv-blueprint

CLI Utility for Validating and Generating CSV files based on custom rules. It ensures your data meets specified criteria, streamlining data management and integrity checks.

573.2k](/packages/jbzoo-csv-blueprint)[k1low/yacsv

Yet another CSV utility plugin for CakePHP

124.0k](/packages/k1low-yacsv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
