jeudi 17 novembre 2016

Design patterns to read file, extract data and store to db

I have to write a program to extract data from different files:

extract_data(url){
    read_file_(url)
    identify_type(file)
    create_customer
    create_product
    create_order(customer, product)
}

The files can be of many types (XML,JSON) but in general they contain these elements:

<customer>
<name> ... </name>
<...> ... <...>
<order>
     <product> 
         <id>...</id> 
         <quantity>..</quantity>
     </product>
</order>
<order>
...
</order>

How can i organize my program with design patterns?

I'm using php and Laravel but any help is welcomed.

Aucun commentaire:

Enregistrer un commentaire