-
-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
Everything goes through the Minimax facade. Resources are org-scoped and
return plain arrays using Minimax's own field names.
Minimax carries the current organisation context and hands you resource
objects.
| Method | Returns | Notes |
|---|---|---|
forOrg($orgId) |
Minimax |
Immutable clone scoped to a different org. |
orgs() |
Orgs |
Not org-scoped. |
customers() items() orders()
|
resource | Org-scoped CRUD. |
invoices() |
Invoices |
CRUD + issue/pdf actions — see Invoices. |
vatRates() currencies() countries() reportTemplates()
|
resource | Code lists. |
resource($slug) |
Generic |
Any endpoint by slug. |
client() |
Client |
The low-level HTTP client. |
Org-scoped resources throw MinimaxException if no org is set. Configure
MINIMAX_ORG_ID or call forOrg($id) first.
Every org-scoped resource shares the same base surface:
| Method | HTTP | Description |
|---|---|---|
all($query = []) |
GET | List records. |
find($id) |
GET | Fetch one record by id. |
byCode($code, $query = []) |
GET | Fetch one record by its business code. |
create($data) |
POST | Create; follows the Location header and returns the created entity. |
update($id, $data) |
PUT | Replace a record. |
delete($id) |
DELETE | Delete a record. |
$rows = Minimax::customers()->all(['PageSize' => 50])['Rows'];
$customer = Minimax::customers()->find(1);
$created = Minimax::customers()->create(['Name' => 'ACME d.o.o.']);
Minimax::customers()->update($created['CustomerId'], ['Name' => 'ACME Ltd']);
Minimax::customers()->delete($created['CustomerId']);create() follows the 201 Created Location header, so it returns the full
record including its RowVersion.
orgs() is the only resource that isn't org-scoped. Use it to discover your
MINIMAX_ORG_ID.
foreach (Minimax::orgs()->all()['Rows'] as $row) {
$row['Organisation']['ID']; // e.g. 123456
$row['Organisation']['Name']; // e.g. "Demo d.o.o."
}vatRates(), currencies(), countries() and reportTemplates() are
read-oriented code lists. byCode() resolves a record by its business code.
$vat = Minimax::vatRates()->byCode('S'); // ['VatRateId' => 1, 'Percent' => 22, ...]
$eur = Minimax::currencies()->byCode('EUR');
$si = Minimax::countries()->byCode('SI');resource($slug) binds the CRUD surface to any org-scoped endpoint at runtime —
no dedicated class needed.
Minimax::resource('journals')->all();
Minimax::resource('accounts')->find(1);Any failed request throws Nejcc\Minimax\MinimaxException, carrying the HTTP
status and the decoded response body.
use Nejcc\Minimax\MinimaxException;
try {
$customer = Minimax::customers()->find(999999);
} catch (MinimaxException $e) {
$e->getCode(); // HTTP status, e.g. 404
$e->body; // decoded response body
}Minimax SDK