indigit / invoicexpress
A simple PHP wrapper for InvoiceXpress API
Installs: 12 623
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 4
Open Issues: 1
Requires
- php: >=7.2.0
- ext-curl: *
- ext-json: *
- fortis/iso-currency: ^1.0
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5.8.0|^6.0|^7.0
- laravel/helpers: ^1.1
- nesbot/carbon: ^1.26.3 || ^2.0
Requires (Dev)
- fzaninotto/faker: ^1.9
- orchestra/testbench: ^4.0
- phpunit/phpunit: 8.0
This package is auto-updated.
Last update: 2024-12-11 01:20:19 UTC
README
This package offers a simple way to create invoices using InvoiceXpress API. InvoiceXpress is a billing/invoicing plataforms available in Portugal and some other countries. After some time looking for a package we didn+t found any that fit our needs so here we are! Please keep in mind some of the endpoints are still to be implement please feel free to push a PR. We don't have any plans right now on finishing them since we don't need it for our own use case. This plugin comes with some Laravel dependencies and tools but it should work out of the box on any non-laravel project
Endpoints Working
- Invoices: Send By Email
- Invoices: Send PDF
- Invoices: Get / Create / Update / Change State
- Invoices: List All
- Invoices: Related Documents
- Invoices: Create / Cancel Payment Receipts
- Estimates: Not implemented yet
- Guides: Not implemented yet
- Purchase Orders: Not implemented yet
- Clients: List All
- Clients: Get / Create / Update / Invoices
- Clients: Find By Code / Find by Name
- Items: Get / Create / Update / Delete / List
- Sequences: Not implemented yet
- Taxes: Get / Create / Update / Delete / List
- Accounts: Get / Create / Update / Create Existing
Installation
Install the package via composer: composer require indigit/invoicexpress
For DEV Build : composer require indigit/invoicexpress --dev
Example of Auth Usage
Each request requires Authentication via Query Parameter, we have done it in a easy way. You should create an InvoiceXpress\Auth by passing your API Key and Account username that can be found at : Account -> Integrations -> API
<?php use InvoiceXpress\Auth; use InvoiceXpress\Api\Invoice; use InvoiceXpress\Exceptions\Generic; use InvoiceXpress\Exceptions\InvalidResponse; $auth = new Auth('YOUR_ACCOUNT_NAME', 'YOUR_API_KEY'); try { # Create the base invoice Item $invoice = Invoice::get($auth, 123456, \InvoiceXpress\Entities\Invoice::DOCUMENT_TYPE_INVOICE); } catch (\Exception $e) { if ($e instanceof InvalidResponse) { dd($e->getBody(), $e->getBodyAsJson()); } elseif ($e instanceof Generic) { dd($e->getMessage(), $e->getContext()); } else { dd($e->getMessage()); } dd($e); }
Usage Examples
For more examples and see how it works please check the "Examples" Folder.
Recommendations
1.: It is strongly recommended to use a .env file to pass your credentials and API keys into the auth object. Never save it with clear text within the project.
2.: It is strongly recommended to create some sort of database logic to keep track of invoices_types and PKs, since InvoiceXpress API has a lot of document types. This could have been easly doen with only one implementation of "Documents" into a single endpoint
Collaborators
License
InvoiceXpress is an open-sourced PHP package licensed under the MIT license and cannot be sold or licensed by any means.