Download the PHP package sirprize/invoiced without Composer

On this page you can find all versions of the php package sirprize/invoiced. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package invoiced

Invoiced

Totals, subtotals, linetotals, VAT-calculations and proper rounding for invoices.

Thanks

See Invoices: How to properly round and calculate totals

Usage

Invoiced handles money amounts in cents.

Discount Resolver

Discount resolver runs a set of custom rules in charge of figuring out an amount to subtract from a given product price.

Defining a custom rule

class TwentyPercentRule implements RuleInterface
{
    protected $product = null;

    public function __construct(\Product $product)
    {
        $this->product = $product;
    }

    public function getAmount()
    {
        return $this->product->getPrice() * 0.2;
    }
}

Running the rules

use Sirprize\Invoiced\BasePrice\Discount\Resolver;
use Sirprize\Invoiced\BasePrice\Discount\RuleInterface;

$product = new \Product(); // this can be anything really...
$resolver = new Resolver(Resolver::BEST); // the rule returning the biggest amount wins
$resolver->addRule(new TwentyPercentRule($product));
$discountAmount = $resolver->getAmount($product->getPrice());
$finalPrice = $product->getPrice() - $discountAmount;

Invoice

Invoice Line Item

use Sirprize\Invoiced\VatPrice\LineItem;

$lineItem = new LineItem(780, 19, true, 1); // $amount, $vatRate, $priceIncludesVat, $quantity

// line item totals
$lineItemGrossTotal = $lineItem->getPrice()->getGrossAmount();
$lineItemVatTotal = $lineItem->getPrice()->getVatAmount();
$lineItemNetTotal = $lineItem->getPrice()->getNetAmount();

// unit
$unitGrossAmount = $lineItem->getUnitPrice()->getGrossAmount();
$unitVatAmount = $lineItem->getUnitPrice()->getVatAmount();
$unitNetAmount = $lineItem->getUnitPrice()->getNetAmount();

Invoice Sum

use Sirprize\Invoiced\VatPrice\LineItem;
use Sirprize\Invoiced\VatPrice\Sum;

$sum = new Sum();

$sum
    ->addLineItem(new LineItem(780, 19, true, 1))
    ->addLineItem(new LineItem(2500, 7, true, 1))
;

$grossTotalAmount = $sum->getPrice()->getGrossAmount();
$vatTotalAmount = $sum->getPrice()->getVatAmount();
$netTotalAmount = $sum->getPrice()->getNetAmount();

Subtotals

Invoices often feature all kinds of subtotals such as discounts, items total, shipping and handling etc.

Base Price

A base price is just a simple object holding the baseprice, the discount amount and the final price of a product:

use Sirprize\Invoiced\BasePrice\Price;

$price = new Price(1000, 220); // $baseAmount, $discountAmount

$baseAmount = $price->getBaseAmount();
$discountAmount = $price->getDiscountAmount();
$finalAmount = $price->getFinalAmount();

Base Price Line Item

use Sirprize\Invoiced\BasePrice\LineItem;

$lineItem = new LineItem($price, 3); // $price, $quantity

// line item totals
$lineItemBaseAmount = $lineItem->getPrice()->getBaseAmount();
$lineItemDiscountAmount = $lineItem->getPrice()->getDiscountAmount();
$lineItemFinalAmount = $lineItem->getPrice()->getFinalAmount();

// unit
$unitBaseAmount = $lineItem->getUnitPrice()->getBaseAmount();
$unitDiscountAmount = $lineItem->getUnitPrice()->getDiscountAmount();
$unitFinalAmount = $lineItem->getUnitPrice()->getFinalAmount();

Base Price Sum

Base prices are then added to line items and summed up:

use Sirprize\Invoiced\BasePrice\LineItem;
use Sirprize\Invoiced\BasePrice\Sum;
use Sirprize\Invoiced\BasePrice\Price;

$sum = new Sum();

$sum
    ->addLineItem(new LineItem(new Price(1000, 220), 3))
    ->addLineItem(new LineItem(new Price(3000, 500), 10))
;

$baseTotalAmount = $sum->getPrice()->getBaseAmount();
$discountTotalAmount = $sum->getPrice()->getDiscountAmount();
$finalTotalAmount = $sum->getPrice()->getFinalAmount();

License

See LICENSE.


All versions of invoiced with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sirprize/invoiced contains the following files

Loading the files please wait ....