Download the PHP package zaber-dev/laravel-quota without Composer

On this page you can find all versions of the php package zaber-dev/laravel-quota. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-quota

Laravel Quota

Latest Version on Packagist Run Tests Total Downloads PHP Version Require License

Supports: Laravel 11, 12 & 13+ • PHP 8.2+ • Redis • Memcached • Database

Application-level quota management for Laravel. Track and enforce usage limits across daily, weekly, monthly, or custom time periods.

Manage quotas with a clean, expressive API using cache or persistent database storage, attach them directly to Eloquent models, protect routes with declarative middleware, and extend the package with custom storage backends.

Unlike Laravel's RateLimiter, which focuses on request throttling, Laravel Quota manages cumulative usage budgets over calendar periods such as daily, weekly, monthly, or custom windows.


Quick Example


Common Use Cases

Laravel Quota is ideal for:


Why not RateLimiter?

Laravel's RateLimiter is excellent for protecting endpoints from bursts of traffic. Laravel Quota doesn't replace RateLimiter. Instead, it complements it by managing cumulative usage across longer calendar periods.

Laravel Quota focuses on application-level usage budgets with:

Feature Laravel RateLimiter Laravel Quota
Primary Purpose High-frequency traffic protection Application-level quota management & usage limits
Fluent Builder API (Quota::for()->perMonth()) Expressive & Clean
First-Class Eloquent Integration ($user->quota()) Native (HasQuotas)
Storage Backends (cache & database) ❌ Cache Only Both Supported
Atomic In-Flight Locking (block()) Built-in
Success-Only Middleware Triggering Only on 2xx / 3xx
Structured Time Windows Sliding window Calendar periods (perMonth(), perDay(), etc.)
Immutable DTOs (QuotaInfo) Strict (CarbonImmutable)
Automatic Database Pruning (model:prune) N/A Built-in (Prunable)
Polymorphic Target Scoping ❌ Manual Keys Automatic Key Mapping
Custom Storage Backend Extensibility (Quota::extend()) Closure / Container
Event Dispatching (QuotaConsumed / Exceeded) Configurable Events

Features


Documentation


Installation

Ready to get started? Install the package with Composer:

Publish the configuration and database migrations:

Run migrations if you intend to use the database storage backend:


Configuration

The configuration file config/quotas.php allows you to define your default storage backend, backend parameters, and event dispatching behaviors:


Usage Guide

1. The Fluent Quota API

The Quota facade provides an expressive builder interface for setting, checking, enforcing, and consuming quotas.

Setting & Consuming a Quota

Enforcing Quotas (enforce)

If you want to automatically halt execution and throw an HTTP 429 Too Many Requests exception without consuming any units when the budget is exhausted, call enforce():

Atomic Block Execution (block)

For operations vulnerable to concurrent bursts or long-running tasks, use the block() helper. block() acquires a temporary atomic lock while the callback executes and only deducts quota units if execution completes successfully:

Resetting / Flushing Quotas


2. Eloquent Model Integration (HasQuotas)

Add the HasQuotas trait to any Eloquent model to scope quotas directly to that entity:

You can now interact directly with your model instance:

Polymorphic Database Querying

When using the database storage backend, HasQuotas also exposes a quotas() polymorphic relationship, allowing direct querying and bulk management:


3. Route Middleware

Protect routes declaratively without writing boilerplate checks in your controllers using the CheckQuota middleware:

How the Middleware Works:


4. Working with Storage Backends (using)

By default, the package uses the storage backend defined in config/quotas.php. You can switch storage backends on the fly per request or action:

Registering Custom Storage Backends

You can extend the QuotaManager with your own storage backends (e.g., DynamoDB, MongoDB) in your AppServiceProvider:


5. Database Pruning (Prunable)

When using the database storage backend, expired records are automatically marked for pruning via Laravel's Prunable trait on the ZaberDev\Quota\Models\Quota model.

To clean up old records automatically, schedule Laravel's model:prune command in your console.php or Kernel.php:


6. Events

Whenever a quota is consumed, exceeded, or reset, the package dispatches strongly typed events if enabled (quotas.events.dispatch = true):

You can listen to these in your EventServiceProvider for logging, monitoring, or webhook triggers.


Agentic Development with Laravel Boost

Laravel Quota includes built-in AI support and architectural skills engineered for Laravel Boost.

When using AI coding assistants (such as Cursor, Claude Code, or GitHub Copilot connected via the Boost MCP server), your AI agent can automatically load specialized design patterns and exact API rules for implementing application-level quotas, usage budgets, and calendar-based usage limits with our package.

Automatic Skill Installation

When Laravel Boost (laravel/boost) is installed in your application, the laravel-quota AI skill is automatically discovered and published during package installation and updates (php artisan boost:install or php artisan boost:update).

If you install zaber-dev/laravel-quota into an existing Boost-enabled project, our service provider also automatically synchronizes the skill directly into your .ai/skills/laravel-quota directory on boot with zero configuration required.

Manual Skill Installation

If you prefer to install or update the AI skill manually, you can use either of the following commands:

What the AI Skill Teaches Your Assistant

By enabling our skill, your AI assistant will strictly follow package conventions, including:


Related Packages

This package is part of the ZaberDev Laravel Ecosystem (Laravel Productivity Toolkit) — a cohesive suite of high-level application primitives engineered for concurrency, state management, and resource allocation.

Explore the complete directory of packages, detailed use cases, and documentation in our Ecosystem Index Hub.


Testing & Quality

Run the comprehensive PHPUnit test suite locally:


Contributing

Thank you for considering contributing! Please ensure any pull requests include thorough PHPUnit tests covering unit, feature, and storage backend integration scenarios.


License

The MIT License (MIT). Please see LICENSE.md for more information.


Built with ❤️ as part of the ZaberDev Laravel Ecosystem.


All versions of laravel-quota with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/cache Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zaber-dev/laravel-quota contains the following files

Loading the files please wait ...