PHPackages                             bigfoot/import-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bigfoot/import-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

bigfoot/import-bundle
=====================

Bigfoot import bundle

2.2.1(11y ago)015.9k31MITPHP

Since Jan 21Pushed 6y ago13 watchersCompare

[ Source](https://github.com/c2is/BigfootImportBundle)[ Packagist](https://packagist.org/packages/bigfoot/import-bundle)[ RSS](/packages/bigfoot-import-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (9)Dependencies (1)Versions (20)Used By (1)

ImportBundle
============

[](#importbundle)

ImportBundle is part of the framework BigFoot created by C2IS.

File formats supported :

- CSV
- XML

How to import XML file
----------------------

[](#how-to-import-xml-file)

See [XmlMapper Documentation](./Resources/doc/xmlmapper.md)

Installation
------------

[](#installation)

Add 'BigFoot/ImportBundle' into your composer.json file in the 'require' section:

```
"require": {
    ...
    ...
    "bigfoot/import-bundle": "dev-master",
}
```

Update your project:

```
php composer.phar update
```

Create your specific import bundle (ie: BigfootQualitelisBundle):

```
app/console generate:update
```

Generate your entity/ies based on the different fields of your csv file (ie: QualitelisNote):

```
app/console generate:doctrine:entity
```

Then update your database:

```
app/console doctrine:schema:update --force
```

Create a directory 'Services' in the root directory of your bundle then create a class file which extends the model 'AbstractSimpleDataMapper'.

```
/* Services/QualitelisNotesDataMapper.php */
class QualitelisNotesDataMapper extends AbstractSimpleDataMapper
{
    ...
}
```

Create some constants for each field you want to import. Their values must be the same as the header's csv.

```
/* Services/QualitelisNotesDataMapper.php */
class QualitelisNotesDataMapper extends AbstractSimpleDataMapper
{
    const FIELD_1           = 'header_field_1';
    const FIELD_2           = 'header_field_2';
}
```

Associate the constants to your repository setters:

```
/* Services/QualitelisNotesDataMapper.php */
class QualitelisNotesDataMapper extends AbstractSimpleDataMapper
{
    const FIELD_1           = 'header_field_1';
    const FIELD_2           = 'header_field_2';

    protected function getColumnMap()
    {
        return array(

            self::FIELD_1       => 'setField1',
            self::FIELD_2       => 'setField2',

            ...
            ...

        );
    }
}
```

Set the coding of your csv file, for instance in UTF8:

```
/* Services/QualitelisNotesDataMapper.php */
class QualitelisNotesDataMapper extends AbstractSimpleDataMapper
{
    const FIELD_1           = 'header_field_1';
    const FIELD_2           = 'header_field_2';

    protected function getColumnMap()
    {
        return array(

            self::FIELD_1       => 'setField1',
            self::FIELD_2       => 'setField2',

            ...
            ...

        );
    }

    protected function getEncodedValue($value) {
        return utf8_encode($value);
    }
}
```

Set the import parameters in your config file:

```
- nb_ligne_par_lot /ftp / csv = number of lines per batch
- max_execution_time = avoid the time out

```

```
# app/config/config.yml
...

bigfoot_import:
    nb_ligne_par_lot :
        ftp :
            csv : 10
    max_execution_time : 500
```

Set the namespace of your bundle and create a service from your mapping class:

```
# Resources/config/services.yml

parameters:
    bigfoot_qualitelis.note_datamapper.class: 'Bigfoot\Bundle\QualitelisBundle\Services\QualitelisNotesDataMapper'
    bigfoot_qualitelis.namespace: 'Bigfoot\Bundle\QualitelisBundle\Entity\'

services:
    bigfoot_qualitelis.note_datamapper:
        class: '%bigfoot_qualitelis.note_datamapper.class%'
        arguments: [@service_container, '%nb_ligne_par_lot.ftp.csv%', '%bigfoot_qualitelis.namespace%']
```

Set the ID key in the method 'getObject' (here the key is FIELD\_1):

```
/* Services/QualitelisNotesDataMapper.php */
class QualitelisNotesDataMapper extends AbstractSimpleDataMapper
{
    const FIELD_1           = 'header_field_1';
    const FIELD_2           = 'header_field_2';

    protected function getColumnMap()
    {
        return array(

            self::FIELD_1       => 'setField1',
            self::FIELD_2       => 'setField2',

            ...
            ...

        );
    }

    protected function getEncodedValue($value) {
        return utf8_encode($value);
    }

    protected function getObject($className, $line)
    {

        $em = $this->container->get('doctrine.orm.default_entity_manager');

        $qualitelis_namespace = $this->container->getParameter('bigfoot_qualitelis.namespace');

        $object = $em->getRepository($qualitelis_namespace.$className)->findOneBy(array(self::FIELD_1 => $line[$this->data->getIndexOfHead(self::FIELD_1)]));

        if (!$object) {
            $fqcn = $qualitelis_namespace.'\\Entity\\'.$className;
            return new $fqcn;
        }

        return $object;
    }
}
```

Configuration
-------------

[](#configuration)

You could define availables protocols for Datasource in your `config.yml`. By default, only http and ftp protocols are availables.

```
# app/config/config.yml

bigfoot_import:
    datasource:
        protocol:
            ftp: FTP
            http: HTTP
            scp: SCP
            ssh: SSH
```

Usage
-----

[](#usage)

Go to the admin interface available at /admin/datasource/.

Add a configuration (name, protocol, domain, port, username, password).

To import, write this into an action method:

```
/* Controller/DefaultController.php */

public function indexAction()
{

    $em = $this->container->get('doctrine.orm.default_entity_manager');

    /* Where 'nameOfTheFtpConfiguration' is the name you entered for the FTP configuration  */
    $object = $em->getRepository('BigfootImportBundle:DataSource')->findOneBy(array('name' => 'nameOfTheFtpConfiguration'));

    $client = $this->get('bigfoot_import.client');
    $client->init($object->getDomain());
    $client->setAuth($object->getUsername(),$object->getPassword());

    $parser = $this->get('bigfoot_import.csvparser');
    $parser->setClient($client);
    $parser->setDelimiter(';');

    /* Name of your csv file in the FTP */
    $data = $parser->parse('nameofthecsvfile.csv');

    /* Name of the service */
    $dataMapper = $this->get('bigfoot_qualitelis.note_datamapper');

    $dataMapper->setData($data);

    /* Name of your entity */
    $dataMapper->className = 'QualitelisNote';

    $dataMapper->map();

    return new Response();
}
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 60.9% 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 ~105 days

Recently: every ~253 days

Total

12

Last Release

3385d ago

Major Versions

1.2.1 → v2.1.02014-06-16

2.2.x-dev → 3.0.x-dev2017-03-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cf973b70f53fe114063efd8ca9e8c9dd45606ad49b5a9dba27fdecb0d0ada64?d=identicon)[gmanen](/maintainers/gmanen)

---

Top Contributors

[![gmanen](https://avatars.githubusercontent.com/u/1336033?v=4)](https://github.com/gmanen "gmanen (67 commits)")[![Acrack](https://avatars.githubusercontent.com/u/1526998?v=4)](https://github.com/Acrack "Acrack (18 commits)")[![nikophil](https://avatars.githubusercontent.com/u/10139766?v=4)](https://github.com/nikophil "nikophil (14 commits)")[![ZeMarine](https://avatars.githubusercontent.com/u/158932?v=4)](https://github.com/ZeMarine "ZeMarine (9 commits)")[![GregoireHebert](https://avatars.githubusercontent.com/u/878701?v=4)](https://github.com/GregoireHebert "GregoireHebert (1 commits)")[![korby](https://avatars.githubusercontent.com/u/1763887?v=4)](https://github.com/korby "korby (1 commits)")

### Embed Badge

![Health badge](/badges/bigfoot-import-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bigfoot-import-bundle/health.svg)](https://phpackages.com/packages/bigfoot-import-bundle)
```

PHPackages © 2026

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