PHP code example of tiloweb / quipu-bundle

1. Go to this page and download the library: Download tiloweb/quipu-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tiloweb / quipu-bundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Tiloweb\QuipuBundle\QuipuBundle(),
        );

        // ...
    }

    // ...
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->listContacts());
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->createContact(array(
        'name' => 'New Contact', // Required
        'email' => '[email protected]',
        'contry_code' => 'fr' // Required
    )));
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->getContact(13423);
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->updateContact(13423, array(
        'name' => 'New name',
        'email' => '[email protected]'
    )));
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->listInvoices());
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->listInvoices(12345));
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    $contactID = 12345;
    $datetime = new \DateTime();
    
    $invoice = array(
        'kind' => 'income', // Required 
        'issue_date' => $datetime->format('Y-m-d') // Required
    );
    
    $items = array(
        array(
            'concept' => 'Product 1',
            'unitary_amount' => "10",
            'quantity' => 30,
            'vat_percent' => 20,
            'retention_percent' => 0
        ),
        array(
            'concept' => 'Product 2',
            'unitary_amount' => "5",
            'quantity' => 10,
            'vat_percent' => 20,
            'retention_percent' => 0
        )
    );
    
    dump($quipu->createInvoice($contactID, $invoice, $items));
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    dump($quipu->getInvoice(13423);
}


// src/AppBundle/Controller/DefaultController.php

public function quipuAction() {
    $quipu = $this->get("quipu");
    
    $datetime = new DateTime();
    
    dump($quipu->updateInvoice(13423, array(
        'paid_at' => $datetime->format('Y-m-d')
    )));
}