scrolltotop

new Get your brand recommended by ChatGPT, Perplexity & AI search engines. Discover GEO.

new We help companies keep track of engineering health with monthly reports. Start your review today.

Laravel Usage Limiter

Concurrency-safe usage metering and billing for SaaS.

Home Company Open Source Laravel Usage Limiter
The Problem

SaaS Billing Is Full of Silent Failures

Race conditions that let users blow past limits. Retries that double-count usage. Crashed jobs that leak reserved capacity nobody ever reclaims. SaaS billing is full of edge cases that silently drain revenue and erode trust.

Building concurrency-safe metering from scratch costs months of engineering time and still leaves gaps. You need atomic operations, idempotency protection, and a reserve-commit lifecycle that handles failures gracefully, and most teams end up reinventing all of it poorly.

The Solution

Laravel Usage Limiter is a production-grade, metric-agnostic usage metering and enforcement engine. A single atomic SQL statement performs "check + reserve" with no TOCTOU race conditions and no overshooting. Idempotency keys prevent double counting on retries. The reserve-execute-commit/release lifecycle prevents leaked capacity from crashed jobs.

Define any metric as a string: AI tokens, API calls, storage megabytes, seats, builds. Choose from prepaid wallet debit, postpaid overage accumulation, or hybrid models with free included allowances. Every major behavior is governed by a contract interface you can swap through configuration.

Built For

AI platforms selling token-based access. API providers metering endpoint calls. Video processing services billing by compute time. IoT platforms counting inbound events. Storage providers metering disk usage. Multi-tenant SaaS with per-workspace quotas. If you meter, limit, or bill for resource consumption in Laravel, this is built for you.

GitHub stars License PHP version Latest version

Key Features

  • Metric-agnostic. Define any metric as a string: ai_tokens, api_calls, storage_mb, seats.
  • Atomic enforcement. Single SQL "check + reserve" prevents concurrency overshoot.
  • Reserve-commit-release. Capacity reserved before work, committed on success, released on failure.
  • Flexible pricing. Prepaid wallet, postpaid overage, or hybrid with free included allowance.
  • Idempotency everywhere. Prevents double counting on retries and double charging.
  • Pluggable architecture. Swap pricing, enforcement, period, and plan resolvers.

Requirements

  • PHP 8.2+
  • Laravel 11.x or 12.x

Installation

composer require moneo/laravel-usage-limiter
View on GitHub
Partnership is at the core of what we do.

Unsure where to start?
Let’s figure it out together 👋

Contact Us