PHPackages                             aiarmada/inventory - 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. aiarmada/inventory

ActiveLibrary

aiarmada/inventory
==================

Multi-location inventory and warehouse management system for Laravel with allocation strategies, cart integration, and movement tracking

v1.0.0(1mo ago)001MITPHP

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/AIArmada/inventory)[ Packagist](https://packagist.org/packages/aiarmada/inventory)[ Docs](https://github.com/aiarmada/commerce)[ RSS](/packages/aiarmada-inventory/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Laravel Inventory
=================

[](#laravel-inventory)

A comprehensive multi-location inventory and warehouse management package for Laravel with allocation strategies, cart integration, and full movement tracking.

Features
--------

[](#features)

- **Multi-Location Support** - Manage inventory across warehouses, stores, and fulfillment centers
- **Allocation Strategies** - Priority-based, FIFO, least-stock, or single-location allocation
- **Split Allocation** - Automatically split orders across multiple locations
- **Cart Integration** - Seamless integration with `aiarmada/cart` package
- **Movement Tracking** - Full audit trail of all inventory movements
- **Reservation System** - Prevent overselling during checkout
- **Per-Product Strategy** - Override global allocation strategy per product
- **Event-Driven** - Dispatch events for low inventory, allocation, and more
- **UUID Support** - First-class UUID support for all models

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

[](#installation)

```
composer require aiarmada/inventory
```

The package auto-discovers and registers itself. Run migrations:

```
php artisan migrate
```

Optionally publish the configuration:

```
php artisan vendor:publish --tag=inventory-config
```

Quick Start
-----------

[](#quick-start)

### 1. Add Trait to Your Model

[](#1-add-trait-to-your-model)

```
use AIArmada\Inventory\Contracts\InventoryableInterface;
use AIArmada\Inventory\Traits\HasInventory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;

class Product extends Model implements InventoryableInterface
{
    use HasUuids, HasInventory;
}
```

### 2. Manage Inventory

[](#2-manage-inventory)

```
use AIArmada\Inventory\Facades\Inventory;

$product = Product::find($id);
$location = InventoryLocation::where('code', 'WAREHOUSE-A')->first();

// Receive inventory
$product->receive($location->id, 100, 'Initial stock');

// Ship inventory
$product->ship($location->id, 5, 'sale', 'ORDER-123');

// Transfer between locations
$product->transfer($fromLocationId, $toLocationId, 20);

// Check availability
$total = $product->getTotalAvailable();          // All locations
$atLocation = $product->getInventoryAtLocation($locationId);

// Check if sufficient inventory exists
$product->hasInventory(10);  // true if >= 10 available across all locations
```

### 3. Use Facades

[](#3-use-facades)

```
use AIArmada\Inventory\Facades\Inventory;
use AIArmada\Inventory\Facades\InventoryAllocation;

// Inventory operations
Inventory::receive($product, $locationId, 100, 'Supplier delivery');
Inventory::ship($product, $locationId, 5, 'sale', 'ORDER-123');
Inventory::transfer($product, $fromId, $toId, 20);
Inventory::getAvailability($product);  // [locationId => available, ...]

// Allocations
InventoryAllocation::allocate($product, 5, 'cart-123', 30);  // Returns Collection
InventoryAllocation::release($product, 'cart-123');
InventoryAllocation::commit('cart-123', 'ORDER-456');
```

Allocation Strategies
---------------------

[](#allocation-strategies)

The package supports multiple allocation strategies:

StrategyDescription`priority`Allocate from highest-priority location first (default)`fifo`Allocate from location with oldest stock`least_stock`Allocate to balance inventory across locations`single_location`Must fulfill from one location or fail### Global Strategy

[](#global-strategy)

Set in config or environment:

```
// config/inventory.php
'allocation_strategy' => 'priority',

// Or via .env
INVENTORY_ALLOCATION_STRATEGY=priority
```

### Per-Product Strategy

[](#per-product-strategy)

Override on individual products:

```
// In your Product model
public function getAllocationStrategy(): ?AllocationStrategy
{
    return $this->allocation_strategy
        ? AllocationStrategy::from($this->allocation_strategy)
        : null;  // null = use global config
}
```

Or set directly on inventory levels:

```
$level = $product->inventoryLevels()->where('location_id', $locationId)->first();
$level->update(['allocation_strategy' => 'single_location']);
```

Split Allocation
----------------

[](#split-allocation)

When enabled (default), allocations can span multiple locations:

```
// Product needs 100 units, Warehouse A has 60, Warehouse B has 50
$allocations = InventoryAllocation::allocate($product, 100, 'cart-123');

// Returns 2 allocations:
// - 60 from Warehouse A
// - 40 from Warehouse B
```

Disable split allocation to require single-location fulfillment:

```
// config/inventory.php
'allow_split_allocation' => false,
```

Cart Integration
----------------

[](#cart-integration)

When installed with `aiarmada/cart`, the package automatically:

1. Extends `CartManager` with inventory methods
2. Releases allocations when carts are cleared
3. Commits inventory on payment success

```
use AIArmada\Cart\Facades\Cart;

// Allocate inventory for checkout
$allocations = Cart::allocateAllInventory(30);  // 30 min TTL

// Validate availability
$validation = Cart::validateInventory();
if (!$validation['available']) {
    foreach ($validation['issues'] as $issue) {
        // $issue['itemId'], $issue['requested'], $issue['available']
    }
}

// Commit after payment
Cart::commitInventory('ORDER-123');

// Release on abandon
Cart::releaseAllInventory();
```

Events
------

[](#events)

EventDescription`InventoryReceived`Stock received at location`InventoryShipped`Stock shipped from location`InventoryTransferred`Stock moved between locations`InventoryAdjusted`Stock level manually adjusted`InventoryAllocated`Stock allocated to cart`InventoryReleased`Allocation released`LowInventoryDetected`Stock below reorder point`OutOfInventory`Available stock reached zeroCommands
--------

[](#commands)

```
# Clean up expired allocations
php artisan inventory:cleanup-allocations
```

Schedule in your console kernel:

```
$schedule->command('inventory:cleanup-allocations')->everyFiveMinutes();
```

Configuration
-------------

[](#configuration)

Key options in `config/inventory.php`:

```
return [
    'allocation_strategy' => 'priority',
    'allocation_ttl_minutes' => 30,
    'allow_split_allocation' => true,
    'default_reorder_point' => 10,

    'cart' => [
        'enabled' => true,
    ],

    'payment' => [
        'auto_commit' => true,
    ],
];
```

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

[](#documentation)

- [Configuration Guide](docs/configuration.md)
- [Allocation Strategies](docs/allocation-strategies.md)
- [Cart Integration](docs/cart-integration.md)
- [Events &amp; Listeners](docs/events.md)
- [API Reference](docs/api-reference.md)

Testing
-------

[](#testing)

```
./vendor/bin/pest tests/src/Inventory
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance96

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

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

Unknown

Total

1

Last Release

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/726da4efcb731bc0ebcdd0b7ce64759e1f8dd63f6f771eab335458f6a2f2d3af?d=identicon)[sairiz](/maintainers/sairiz)

### Embed Badge

![Health badge](/badges/aiarmada-inventory/health.svg)

```
[![Health](https://phpackages.com/badges/aiarmada-inventory/health.svg)](https://phpackages.com/packages/aiarmada-inventory)
```

PHPackages © 2026

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