2017 © Pedro Peláez
 

symfony-bundle csv-bundle

webworksCSVBundle

image

webworksnbg/csv-bundle

webworksCSVBundle

  • Monday, October 30, 2017
  • by adachauer
  • Repository
  • 2 Watchers
  • 2 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 7 % Grown

The README.md

webworksCSVBundle

The webworksCSVBundle helps you to handle csv data and files in your Symfony application. It provides a simple YAML based mapping for doctrine., (*1)

Requirements

  • PHP 7.x
  • Symfony 3.x
  • See also the composer.json file

Installation

Step 1: Download webworksCSVBundle using composer

Require the bundle with composer:, (*2)

composer require webworksnbg/csv-bundle "~0.1"

Step 2: Enable the bundle

Enable the bundle in the kernel:, (*3)

``` php // app/AppKernel.php, (*4)

public function registerBundles() { $bundles = array( // ... new webworks\CSVBundle\webworksCSVBundle(), // ... ); }, (*5)


### Step 3: Create the mapping YAML file Create a YAML file with the following content (for example): ``` yaml # app/config/csv/mapping.yml import: # not supported in the current version export: clients: # mapping name class: acme\AppBundle\Entity\Kunde mapping: name: firstname, lastname street: street city: zip, city email: email company: company_name

Note: Currently, only one export of the data is possible. The import function will follow shortly, (*6)

Step 4: Use the mapping service to write data from your database to csv

You can call the service from container:, (*7)

``` php // where ever you have an container, (*8)

$csvPath = $this->getContainer()->get('webworks.csv.mapping') ->setMappingName('clients') // mapping name ->setMode('export') ->process() ->getPath(); // Temporary file path!, (*9)


### Step 5: Enjoy :) Now, you can easily write data from your database via doctrine to csv. ## Credits This bundle has been created by [webworks nürnberg](http://webworks-nuernberg.de) and the community. ## Examples ### Parse CSV file ``` php use webworks\CSVBundle\Lib\ParseCSV; $parser = new ParseCSV('example.csv', ';', '"'); $data = $parser->parse();

The Versions

29/10 2017

dev-add-code-of-conduct-1

dev-add-code-of-conduct-1 http://webworks-nuernberg.de

webworksCSVBundle

  Sources   Download

webworks license

The Requires

 

by webworks nürnberg UG

csv symfony webworks nürnberg csv handling csv import csv export csv mapping