survos/grid-group-bundle
最新稳定版本:1.6.44
Composer 安装命令:
composer require survos/grid-group-bundle
包简介
Handle groups of CSV as a spreadsheet
关键字:
README 文档
README
Under development! And will probably be replaced by Pixy/Pixie/KeyValue bundle, which uses Sqlite instead of csv. But some tools here could be helpful.
A bundle to manipulate a set of CSV files as a database. The idea is to avoid having to create temporary entities or models during the data import.
CsvParser
The CSV Reader class is an excellent way to read records from csv.
$csv = Reader::createFromPath('/path/to/file.csv', 'r'); $csv->setHeaderOffset(0); $header_offset = $csv->getHeaderOffset(); //returns 0 $header = $csv->getHeader(); //returns ['First Name', 'Last Name', 'E-mail']
Example: create a simple related table.
Given a movie CSV table, create a CsvDatabase (GridGroup?)
id,title,poster,overview,release_date,genres 287947,Shazam!,https://image.tmdb.org/t/p/w500/xnopI5Xtky18MPhK40cZAGAOVeV.jpg,"A boy is given the ability to become an adult superhero in times of need with a single magic word.",1553299200,"Action, Comedy, Fantasy" 299537,"Captain Marvel",https://image.tmdb.org/t/p/w500/AtsgWhDnHTq68L0lLsUrCnM7TjG.jpg,"The story follows Carol Danvers as she becomes one of the universe’s most powerful heroes when Earth is caught in the middle of a galactic war between two alien races. Set in the 1990s, Captain Marvel is an all-new adventure from a previously unseen period in the history of the Marvel Cinematic Universe.",1551830400,"Action, Adventure, Science Fiction"
Create a movie.csv and genre.csv, with genre counts as an extra field
We need a schema to define the output csv database, which we can create by naming the fields.
$gridGroup = new GridGroup('movie_and_genre'); $grid = (new \Survos\GridGroupBundle\Model\Grid('movie')); $grid->addRow()
Defining the schema
统计信息
- 总下载量: 1.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-01