Download the PHP package invoiceninja/sdk-php without Composer
On this page you can find all versions of the php package invoiceninja/sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sdk-php
Invoice Ninja SDK v5!
Installation
Add the Invoice Ninja SDK
composer require invoiceninja/sdk-php
Setup
- To connect to a self hosted version use
->setUrl()
on the $ninja object.
Supports
- Clients
- Invoices
- Quotes
- Products
- Payments
- TaxRates
- Statics
- Expenses
- Expense Categories
- Recurring Invoices
- Credits
- Projects
- Tasks
- Vendors
- Companies
- Subscriptions
- Purchase Orders
- Bank Integrations
- Bank Transactions
Retrieving Models
Retrieve all clients
You can perform complex filtering on the ->all() method.
Query parameters can be chained together to form complex queries. The current supported values are:
per_page: The number of clients per page you want returned
page: The page number
include: A comma separated list of relations to include ie. contacts,documents,gateway_tokens
balance: A query to return clients with a balance using an operator and value
- ie ?balance=lt:10 Returns clients with a balance less than 10
- available operators lt, lte, gt, gte, eq
between_balance: Returns clients with a balance between two values
- ie ?between_balance=10:20 - Returns clients with a balance between 10 and 20
email: Returns clients with a contacts.email field equal to an email
id_number: Search by id_number
number: Search by number
filter: Search across multiple columns (name, id_number, first_name, last_name, email, custom_value1, custom_value2, custom_value3, custom_value4)
created_at: Search by created at (Unix timestamp)
is_deleted: Search using is_deleted boolean flag
For example,
Retrieve a client by its primary key.
Retrieving an invoice by it's number:
Inserting & Updating Models
Create a new client
Create a new Client with a contact
Update an existing client
Please Note
When updating a client, you must always include the current contacts (array), if no contacts are included, the system will wipe the contacts from the client record.
Create an invoice
When creating an invoice, you can perform actions on the invoice in a single call, for example, say you wish to create an invoice and also apply a payment to the invoice:
Or if you wish to apply a partial payment
Or you may want to automatically send and charge the invoice note requires a payment method on file
Bulk actions
You can perform bulk actions against one or many entities. For example if you wish to batch archive a range of invoice you would do
You can access the raw bulk method using the following:
If you wanted to download a invoice PDF
The following are a list of available bulk actions for invoices:
- mark_sent
- download
- restore
- archive
- delete
- paid
- clone_to_quote
- clone_to_invoice
- cancel
- reverse
For more examples of what can be achieved with the SDK, please inspect the tests folder in this repository. If you need clarity or more explicit examples of how to use the SDK, please create a issue.