PHPackages                             fleetbase/ledger-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fleetbase/ledger-api

ActiveLibrary[API Development](/categories/api)

fleetbase/ledger-api
====================

Accounting &amp; Invoicing Extension for Fleetbase

0.0.3(2mo ago)3891↓61.6%9[2 PRs](https://github.com/fleetbase/ledger/pulls)1AGPL-3.0-or-laterPHPPHP ^8.0CI passing

Since Mar 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/fleetbase/ledger)[ Packagist](https://packagist.org/packages/fleetbase/ledger-api)[ RSS](/packages/fleetbase-ledger-api/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (22)Versions (7)Used By (1)

 [ ![Fleetbase Ledger](https://private-user-images.githubusercontent.com/816371/351205780-197c404c-06b1-4fd4-8a26-624f1d481966.svg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA4NzczNjgsIm5iZiI6MTc4MDg3NzA2OCwicGF0aCI6Ii84MTYzNzEvMzUxMjA1NzgwLTE5N2M0MDRjLTA2YjEtNGZkNC04YTI2LTYyNGYxZDQ4MTk2Ni5zdmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDYwOFQwMDA0MjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lMjU2MzY3YjkzMjgyNWJmNDEwY2Q3MmNiYmIxYjU1NTJjYWQwYWFiOWU2Yjk4OWM0M2IxY2UyYzYxOWY1ZDYzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZzdmclMkJ4bWwifQ.ZP-E47K5RKkTqCXDBW0CQRH_23wKGu1L1D67zv_h12o) ](https://fleetbase.io)

Fleetbase Ledger
================

[](#fleetbase-ledger)

 Accounting, invoicing, wallets, payments, and financial reporting for Fleetbase.

 [![License: AGPL-3.0-or-later](https://camo.githubusercontent.com/398898b5adf87bbb4595fa050c0881480ef4bdfb0dd23527fb62ba4ea29c6717/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4147504c2d2d332e302d2d6f722d2d6c617465722d626c75652e737667)](https://github.com/fleetbase/ledger/blob/main/LICENSE.md) [![PHP CI](https://github.com/fleetbase/ledger/actions/workflows/server.yml/badge.svg)](https://github.com/fleetbase/ledger/actions/workflows/server.yml) [![Ember CI](https://github.com/fleetbase/ledger/actions/workflows/ember.yml/badge.svg)](https://github.com/fleetbase/ledger/actions/workflows/ember.yml) [![Packagist version](https://camo.githubusercontent.com/d8be7e24693f31fe3531aba66c3bc6d1954d0a39dd8880341f8e8bc7c64ab599/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c656574626173652f6c65646765722d6170692e737667)](https://packagist.org/packages/fleetbase/ledger-api) [![npm version](https://camo.githubusercontent.com/1024c2635f1102fec96e3f06e7e922ebc6b98129f0f78df906d39248da792681/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f40666c656574626173652f6c65646765722d656e67696e652e737667)](https://www.npmjs.com/package/@fleetbase/ledger-engine) [![Ledger documentation](https://camo.githubusercontent.com/659a939fc4a290f8d2968bc0995565626aaf9a4c9d832c6afb794850c5a18ea2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d6c65646765722d3131313832372e737667)](https://www.fleetbase.io/docs/ledger)

 [ ![Fleetbase Ledger dashboard](https://camo.githubusercontent.com/f1e81ca8073888da5b4e5e72d75e290c2027efbb936fb5ab5719f65d71eb1da9/68747470733a2f2f7777772e666c656574626173652e696f2f696d616765732f73637265656e73686f74732f6c65646765722f6c65646765722d64617368626f6172642e77656270) ](https://www.fleetbase.io/images/screenshots/ledger/ledger-dashboard.webp)

Overview
--------

[](#overview)

Ledger is the finance and billing extension for Fleetbase. It adds a complete financial management layer to the Fleetbase console, including double-entry bookkeeping, customer invoicing, invoice templates, digital wallets, payment gateway processing, immutable transaction history, and standard financial reports.

Ledger ships as both a Laravel package and an Ember engine. The backend package provides the accounting models, services, routes, gateway drivers, events, observers, migrations, and console commands. The frontend engine provides the Ledger console experience for billing, payments, accounting, reports, and settings.

Ledger is included with standard Fleetbase installations. See the [Fleetbase Ledger documentation](https://www.fleetbase.io/docs/ledger) for the product guide, concepts, and setup walkthroughs.

Contents
--------

[](#contents)

- [Features](#features)
- [Architecture](#architecture)
- [Requirements](#requirements)
- [Installation](#installation)
- [Development](#development)
- [API and Extension Points](#api-and-extension-points)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Security](#security)
- [License](#license)

Features
--------

[](#features)

### Accounting

[](#accounting)

- Chart of accounts for asset, liability, equity, revenue, and expense accounts.
- Double-entry journal entries with debit and credit accounts.
- Cached account balances with recalculation support.
- General ledger views per account and across the company.
- System-created and manual journal entries for operational accounting workflows.

### Billing and Invoicing

[](#billing-and-invoicing)

- Customer invoices with line items, tax, subtotal, total, balance, due date, notes, and terms.
- Invoice lifecycle support for draft, sent, viewed, paid, overdue, cancelled, refunded, and void states.
- Invoice templates with company branding and registered template context variables.
- Invoice previews, rendered PDFs, invoice emails, and public customer invoice pages.
- Manual payment recording and invoice transaction history.
- Fleet-Ops purchase-rate integration for automatically generating draft invoices from orders.

### Wallets and Transactions

[](#wallets-and-transactions)

- Digital wallets for companies, users, customers, drivers, and other Fleetbase subjects.
- Wallet operations for top-ups, credits, transfers, payouts, freezes, unfreezes, and recalculation.
- Atomic balance changes through `WalletService`.
- Immutable transaction records for wallet activity, payment activity, and operational money movement.
- Direction-aware transaction history for credits, debits, deposits, payouts, transfers, refunds, and reversals.

### Payment Gateways

[](#payment-gateways)

- Built-in gateway drivers for Stripe, QPay, and Cash/manual payments.
- Gateway configuration with encrypted credentials at rest.
- Sandbox and live environments.
- Purchases, refunds, setup intents, tokenization where supported, and gateway transaction history.
- Public gateway webhook endpoint with driver-level signature verification.
- Idempotent gateway processing through `GatewayTransaction` records.

### Reports and Dashboard

[](#reports-and-dashboard)

- Financial dashboard with KPIs, revenue trends, cash flow summaries, invoice status, AR aging, wallet balances, and activity.
- Standard financial reports for balance sheet, income statement, cash flow statement, trial balance, AR aging, wallet summary, and general ledger.
- Report services built around double-entry accounting data and Fleetbase transaction records.

### Fleetbase Integrations

[](#fleetbase-integrations)

- Fleet-Ops integration for purchase-rate invoice creation and order accounting.
- Storefront integration for direct storefront sale journal entries.
- Company and user observers that provision default accounts and wallets automatically.
- Invoice, payment, and accounting settings inside the Fleetbase console.

Architecture
------------

[](#architecture)

Ledger is split into two distributable packages:

PackageRuntimeDescription[`fleetbase/ledger-api`](https://packagist.org/packages/fleetbase/ledger-api)Laravel / PHPBackend models, routes, services, migrations, gateway drivers, observers, events, resources, reports, and console commands.[`@fleetbase/ledger-engine`](https://www.npmjs.com/package/@fleetbase/ledger-engine)EmberFleetbase console engine for the Ledger dashboard, billing, payments, accounting, reports, and settings screens.Backend routes are mounted under the configured Ledger API prefix, which defaults to `ledger`.

Route groupAuthenticationPurpose`POST /ledger/webhooks/{driver}`Public, driver verifiedPayment gateway webhook callbacks.`/ledger/public/invoices/{public_id}`PublicCustomer invoice view, gateway list, and payment flow.`/ledger/v1/wallet/*`API keyCustomer and driver wallet API endpoints.`/ledger/int/v1/*`Fleetbase sessionConsole APIs for accounts, invoices, journals, wallets, transactions, gateways, settings, and reports.The Ember engine mounts at the Fleetbase extension route `ledger` and exposes console sections for billing, payments, accounting, reports, and settings.

Requirements
------------

[](#requirements)

- PHP `^8.0`
- Composer
- Fleetbase Core API
- Fleetbase FleetOps API
- Node.js `>=18`
- pnpm
- Ember CLI compatible with the workspace

Installation
------------

[](#installation)

Ledger comes pre-installed with Fleetbase. In a standard Fleetbase instance, open the console sidebar and navigate to Ledger to begin. Default accounts and wallets are provisioned automatically for new companies and users.

For package-level installation:

```
composer require fleetbase/ledger-api
```

```
pnpm install @fleetbase/ledger-engine
```

If you are adding Ledger to an existing Fleetbase installation, run migrations through your normal Fleetbase deployment flow, then provision defaults for existing records:

```
php artisan ledger:provision
```

Development
-----------

[](#development)

### Fleetbase workspace linking

[](#fleetbase-workspace-linking)

When working on Ledger inside a full Fleetbase checkout, use Fleetbase's package linker from the repository root instead of hand-editing `console/package.json`, `api/composer.json`, or `console/pnpm-workspace.yaml`.

Install the linker once from the Fleetbase repository root:

```
npm link
```

Enable Ledger as a local development package:

```
flb-package-linker enable ledger
flb-package-linker install ledger
```

Use `--install` to let the linker run the required package-manager commands immediately:

```
flb-package-linker enable ledger --install
```

Check link state with:

```
flb-package-linker status
flb-package-linker doctor
```

See the [Fleetbase development setup guide](https://www.fleetbase.io/docs/platform/quickstart/development-setup) for Docker mounts, local Ember dev server setup, package-linker details, and unlink/reset commands. Fleetbase runs Laravel Octane, so reload the API worker after PHP changes:

```
docker compose exec application php artisan octane:reload
```

### Package-level development

[](#package-level-development)

Install dependencies:

```
composer install
pnpm install
```

Run the Ember engine locally:

```
pnpm start
```

Frontend checks:

```
pnpm lint
pnpm test
pnpm build
```

Backend checks:

```
composer test:lint
composer test:types
composer test:unit
composer test
```

Ledger Artisan commands:

```
php artisan ledger:provision
php artisan ledger:backfill-direction
php artisan ledger:update-overdue-invoices
```

`ledger:provision` is idempotent and can target all companies, one company, accounts only, or wallets only. `ledger:backfill-direction` fills missing transaction directions on older transaction rows. `ledger:update-overdue-invoices` marks sent or viewed invoices as overdue when their due date has passed.

API and Extension Points
------------------------

[](#api-and-extension-points)

Ledger exposes backend services for accounting, wallets, invoices, and payments:

- `LedgerService` creates double-entry journal entries and powers financial reports.
- `WalletService` manages wallet provisioning and balance-changing operations.
- `InvoiceService` creates and manages invoices, including order-based invoice creation.
- `PaymentService` coordinates gateway charges, refunds, setup intents, events, and gateway transaction persistence.
- `PaymentGatewayManager` resolves and initializes configured payment gateway drivers.

Custom payment gateways can extend `AbstractGatewayDriver` and implement the `GatewayDriverInterface` contract. Gateway drivers provide a code, name, capability list, configuration schema, purchase/refund behavior, and optional webhook or tokenization support.

Ledger also registers invoice template context variables with Fleetbase's template rendering system so invoice templates can reference invoice, transaction, account, and wallet data during rendering.

Documentation
-------------

[](#documentation)

- [Ledger documentation](https://www.fleetbase.io/docs/ledger)
- [Core concepts](https://www.fleetbase.io/docs/ledger/getting-started/core-concepts)
- [Payment gateways](https://www.fleetbase.io/docs/ledger/payments/gateways)
- [Adding a payment gateway driver](https://www.fleetbase.io/docs/extension-development/recipes/adding-a-payment-gateway-driver)
- [Fleetbase development setup](https://www.fleetbase.io/docs/platform/quickstart/development-setup)

Contributing
------------

[](#contributing)

Contributions are welcome. Please read the [contributing guide](CONTRIBUTING.md) before opening a pull request.

For local changes, keep frontend and backend checks focused on the area you touched and include relevant test output in your pull request.

Security
--------

[](#security)

Please do not report security issues in public GitHub issues. Contact Fleetbase at  with details so the team can coordinate a responsible fix.

License
-------

[](#license)

Fleetbase Ledger is open-source software licensed under the [AGPL-3.0-or-later](LICENSE.md).

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance92

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Total

3

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9350b92834554a15fb0fff7c7c73750c86a5edd5038e4f0006f8b888a9379b57?d=identicon)[fleetbase](/maintainers/fleetbase)

---

Top Contributors

[![roncodes](https://avatars.githubusercontent.com/u/816371?v=4)](https://github.com/roncodes "roncodes (102 commits)")

---

Tags

invoicingAccountingfleetbasefleetbase-extensionpayrollsettlementsfinance management apiaccounting system

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fleetbase-ledger-api/health.svg)

```
[![Health](https://phpackages.com/badges/fleetbase-ledger-api/health.svg)](https://phpackages.com/packages/fleetbase-ledger-api)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[fleetbase/fleetops-api

Fleet &amp; Transport Management Extension for Fleetbase

1728.1k5](/packages/fleetbase-fleetops-api)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
