The Ledger PHP API
Applications communicate with the Ledger API through lightweight Message
models. These models
are passed to the Ledger controllers and the controllers return responses, typically in the form of
an Eloquent Model or Collection of Models.
Ledger's Message models also closely correspond to the requests made through the JSON API. Each
message has a fromRequest()
factory that will accept the input from a JSON request and populate
the message.
Messages
The message types are:
Message Type | Purpose |
---|---|
Account | For Ledger account operations that are not balance affecting. |
AccountQuery | Request information about accounts. |
Balance | Requesting the balance of a Ledger Account |
Create | Creating a new Ledger |
Currency | Managing currencies available to the Ledger |
Detail | Part of an Entry Message |
Domain | Manages Domains within the Ledger. |
EntityRef | For references to other objects connected to the Ledger. |
Entry | Represents a journal Entry. |
EntryQuery | Request information about journal entries. |
Name | Multilingual name support for Ledger entities. |
Reference | Manage soft links to external data. |
Report | Request a report. |
SubJournal | Managing additional Ledger journals. |
The parent Message
class defines a set of flags for operations (Message::OP_*
constants) and other
functions associated with message processing (Message::F_*
constants). These flags are used for message
routing and validation.
Controllers
Ledger's controllers contain methods for common operations, along with a run()
method
that accepts the message and operations flags defined by the Message class. The run method then
routes the message to the appropriate method.
Controller | Function |
---|---|
JournalEntryController | Manages Journal entries. |
JournalReferenceController | Manages Journal external references. |
LedgerAccountController | Create a Ledger, manage Ledger accounts. |
LedgerCurrencyController | Manage ledger currencies. |
LedgerDomainController | Manage ledger domains. |
ReportController | Handle report requests. |
SubJournalController | Manage sub-journals. |