Download the PHP package aldeebhasan/inventorix without Composer
On this page you can find all versions of the php package aldeebhasan/inventorix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aldeebhasan/inventorix
More information about aldeebhasan/inventorix
Files in aldeebhasan/inventorix
Package inventorix
Short Description Modern inventory control for Laravel applications. Features include stock tracking, movement history, low stock alerts, and seamless integration with your existing models
License MIT
Homepage https://github.com/aldeebhasan/inventorix
Informations about the package inventorix
Inventorix — Modern Inventory Control for Laravel
Inventorix is a Laravel package that adds full inventory control to any Eloquent model. It handles stock tracking, movement history, reservations, FIFO/LIFO/Average costing, threshold alerts, serial number tracking, transaction rollback, and demand velocity — all without changing your existing models.
Installation
Publish and run the migrations:
Publish the config file:
Setup
Add the HasInventory trait to any Eloquent model you want to track:
You must have at least one Location record in the database before performing stock operations. Locations represent warehouses, bins, or any physical storage unit and support parent/child hierarchies via parent_id.
Basic Usage
You can use the HasInventory trait methods directly on the model, or the Inventorix facade for lower-level control.
Stock Operations
StockOperationDto
Pass a StockOperationDto as the last argument to any operation to control its behaviour:
Bulk / Grouped Transactions
Group multiple operations into a single atomic transaction:
If any operation inside the callback throws, the transaction is marked RolledBack and the exception propagates.
Transaction Rollback
Reverse a committed transaction by creating a compensating reversal:
This replays every movement in reverse (adds become deducts and vice-versa), handles serial number compensation automatically, and fires a TransactionRolledBack event.
Reservations
Reservations hold stock aside without permanently deducting it:
Reservations can have a TTL set via config (reservation_ttl_minutes) or per-call via StockOperationDto::$expiresAt. Run the scheduled command to expire stale reservations:
Querying Stock
Valuation
Costing strategy is set in config (fifo, lifo, or average). Movements must carry a cost_per_unit value (set via StockOperationDto::$cost) for movement-based costing to apply.
Demand Velocity
Thresholds & Alerts
Threshold checks run automatically after every addStock, deductStock, and adjustStock call. When stock crosses a boundary the package fires LowStockReached or OverstockReached. To find all items currently below threshold:
Alert events can optionally be dispatched on a queue (queue_alerts / alert_queue in config). Threshold records are cached in-memory (configurable TTL via threshold_cache) to avoid a DB hit on every stock write.
Serial Number Tracking
Enable in config:
When enabled, every addStock auto-generates a ULID serial number per unit, and every deductStock auto-consumes the oldest available serials at that location (FIFO). You can also supply explicit serial numbers:
Reservations also lock specific serials:
Lifecycle Hooks
Register callbacks that fire before/after add and deduct operations:
Custom Costing Strategy Per Model
Override the costing strategy for a specific model by implementing inventorixCostingStrategy():
Events
All events live in Aldeebhasan\Inventorix\Events\. Disable all events or specific ones in config:
| Event | Fired when |
|---|---|
StockAdded |
Stock is added |
StockDeducted |
Stock is deducted |
StockAdjusted |
Stock is adjusted |
StockTransferred |
A transfer completes |
StockReserved |
A reservation is created |
ReservationReleased |
A reservation is released |
ReservationFulfilled |
A reservation is fulfilled |
ReservationExpired |
A reservation is expired by the command |
LowStockReached |
Stock falls at or below a min threshold |
OverstockReached |
Stock rises at or above a max threshold |
TransactionRolledBack |
A transaction is reversed |
Artisan Commands
| Command | Description |
|---|---|
inventorix:expire-reservations |
Release all reservations past their TTL |
inventorix:prune-movements |
Delete movements older than movement_prune_after_days |
inventorix:stock-report |
Generate a stock report |
Schedule the expiry command in your application's scheduler:
Configuration Reference
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Hasan Deeb
- All Contributors
License
The MIT License (MIT). Please see License File for more information.