This bundle provides an invoice base system for Symfony2.
Installation is a 3 step process:
- Download BSPInvoiceBundle using composer
- Enable the Bundle
- Configure the bundle
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/D3r3ck/BSPInvoiceBundle"
}
],
"require": {
"d3r3ck/bsp-invoice-bundle": "v1.0.*"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update d3r3ck/bsp-invoice-bundle
Composer will install the bundle to your project's vendor/d3r3ck/bsp-invoice-bundle
directory.
Enable the bundle in the kernel:
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new BSP\InvoiceBundle\BSPInvoiceBundle(),
);
}
Add the following lines to your config.yml
# app/config/config.yml
bsp_invoice:
db_driver: mongodb # Currently only works with mongodb, we are working on orm
And you are done!
This bundle works basically by an invoice manipulator:
$manipulator = $this->get('bsp_invoice.manipulator');
In order to create an invoice you only have to do:
$myInvoice = $manipulator->createInvoice( $provider, $customer, 'I0001', 'EUR' );
An now you want to add some lines
use BSP\InvoiceBundle\Model\InvoiceLineInterface;
$manipulator->addLine( $myInvoice, InvoiceLineInterface::TYPE_PRODUCT, 'reference', 'My description', 1, 12.34 );
Supported invoice line types are:
- TYPE_PRODUCT
- TYPE_SERVICE