We're starting work on custom modules, join the discussion here.
Add the Invoice Ninja SDK
composer require invoiceninja/sdk-php
use InvoiceNinja\Config as NinjaConfig;
use InvoiceNinja\Models\Client;
NinjaConfig::setURL('https://ninja.dev/api/v1');
NinjaConfig::setToken('Your Token');
- To connect to the hosted version use
https://app.invoiceninja.com/api/v1
as the URL. - You can either use the free hosted trial or install the app to create an API token.
- Clients
- Invoices/Quotes
- Products
- Payments
- Tasks
- Vendors
- Expenses
- TaxRates
Retrieve all clients
$clients = Client::all();
Retrieve a client by its primary key.
$client = Client::find(1);
Create a new client
$client = new Client('test@example.com');
$client->save();
Update an existing client
$client->vat_number = '123456';
$client->save();
Create an invoice
$invoice = $client->createInvoice();
$invoice->addInvoiceItem('Item', 'Some notes', 10);
$invoice->save();
Download an invoice PDF
$pdf = $invoice->download();
$client->archive();
$client->delete();
$client->restore();
Register subscription for new client
Client::subscribeCreate('http://example.com/...');
Convert posted data to a model
$client = Client::hydrate($input);
Currently supported for clients, invoices, quotes and payments
- Improve validation and error handling
- Create documentation