Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dalpo/cakephp_csv_datasource
Cakephp CSV files datasource
https://github.com/dalpo/cakephp_csv_datasource
Last synced: 17 days ago
JSON representation
Cakephp CSV files datasource
- Host: GitHub
- URL: https://github.com/dalpo/cakephp_csv_datasource
- Owner: dalpo
- Created: 2010-01-18T16:21:27.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2017-07-22T20:07:02.000Z (over 7 years ago)
- Last Synced: 2024-10-09T14:22:57.739Z (28 days ago)
- Language: PHP
- Homepage: http://github.com/dalpo/cakephp_csv_datasource
- Size: 102 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
CSV Datasource for reading your CSV files
Originally based on work of Siegfried Hirsch (Siegfried):
http://bakery.cakephp.org/articles/view/csv-datasource-for-reading-your-csv-filesiLicensed under The MIT License
Redistributions of files must retain the above copyright notice.Example:
1. Copy the data source file on your models/datasources/ directory
/app/models/datasources/csv_sourse.php
2. Setup your database connection:
class DATABASE_CONFIG {public $csvFileConfig = array(
'datasource' => 'csv',
'path' => "/path/to/your/file.csv",
'header_row' => 7 // It use this row as header and start to read data from next row... previous rows will be ignored
);public $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => ''
);
}3. Setup your model
4. Now you can retrive the csv data from controller
MyModel->find('all', array('page' => 2, 'limit' => 10));$this->set('csvData', $csvData);
}
}
?>