vivek-mistry / laravel-inventory-core
Core stock & inventory engine for Laravel applications
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/vivek-mistry/laravel-inventory-core
Requires
- php: ^8.2||^8.3||^8.4||^8.5
- illuminate/support: ^10|^11|^12
- orchestra/testbench: ^10.0.0||^9.0.0
- phpunit/phpunit: *
README
๐ฆ Laravel Inventory Core
A Headless Stock & Inventory Engine for Laravel
A lightweight, extensible inventory management core for Laravel applications.
Built for e-commerce, POS, ERP, invoicing, and warehouse systems.
โญ No UI
๐ง Logic-first
โก Production-ready
๐ Why Laravel Inventory Core?
Most inventory packages are:
โ UI-heavy
โ Hard to customize
โ Tied to specific schemas \
Laravel Inventory Core is different.
โ Works with any Eloquent model
โ Multi-warehouse ready
โ Prevents overselling
โ Event-driven & audit-safe
โ Clean API developers love
โจ Features
โ Core Inventory
- Stock in / stock out
- Stock adjustments
- Available vs reserved stock
- Negative stock protection
๐ Reservation System
- Cart & order reservations
- Overselling prevention
- Safe release mechanism
๐ฌ Warehouses
- Multiple warehouses / godowns
- Default warehouse support
- Warehouse-aware stock
๐ Audit & Reliability
- Complete stock movement history
- Traceable inventory changes
- Accounting-friendly design
๐จ Low Stock Alerts
- Threshold-based alerts
- Event-driven notifications
๐ Ideal For
โ Laravel e-commerce platforms
โ POS systems
โ ERP & internal tools
โ Invoice & billing systems
โ SaaS products needing inventory
๐ ๏ธ Installation
Install the package via Composer:
composer require vivek-mistry/laravel-inventory-core
Publish config (optional):
php artisan vendor:publish --tag=inventory-config
Run migrations:
php artisan migrate
โ๏ธ Configuration
config/inventory.php
return [ 'default_warehouse' => null, 'allow_negative_stock' => false, 'low_stock_threshold' => 5, ];
๐งฑ Database Tables
| Table | Purpose |
|---|---|
inventory_stocks |
Current stock per model |
inventory_movements |
Complete stock audit trail |
inventory_warehouses |
Multi-warehouse support |
๐งฉ Making a Model Stockable
Use the Stockable trait on any Eloquent model.
use VivekMistry\InventoryCore\Traits\Stockable; class Product extends Model { use Stockable; }
Thatโs it ๐
๐งฎ Basic Usage
Add Stock
$product->addStock(100);
With warehouse
$product->addStock(50, ['reason' => 'Initial stock'], warehouseId: 1);
โ Reduce Stock
$product->reduceStock(5);
๐ Reserve Stock (Cart / Order)
Prevents overselling.
$product->reserveStock(2);
With warehouse:
$product->reserveStock(2, warehouseId: 1);
๐ Release Reserved Stock
$product->releaseStock(2);
๐ Stock Helpers
$product->availableStock(); // quantity - reserved $product->reservedStock();
๐ฌ Warehouses
Warehouses are optional but recommended.
InventoryWarehouse::create([ 'name' => 'Main Warehouse', 'code' => 'MAIN', 'is_default' => true, ]);
If no warehouse is provided, the default warehouse is used.
๐จ Low Stock Detection Triggered automatically when stock falls below threshold.
'low_stock_threshold' => 5,
Listen to the event:
use InventoryCore\Events\LowStockDetected; Event::listen(LowStockDetected::class, function ($event) { // Send email, Slack, notification, etc. });
## ๐งช Example Flow (Real-World) $product->addStock(100); $product->reserveStock(10); // Cart $product->availableStock(); // 90 $product->releaseStock(5); // Cart cancelled $product->reduceStock(5);
๐งช Testing
vendor/bin/phpuit
Change Logs
- Initial 2 Phases are released.
Credits
- Vivek Mistry - Project creator and maintainer
๐ค Contributing
Pull requests are welcome.
Ideas, issues, and improvements are encouraged.
โญ Support the Project
If this package helps you:
๐ Star the repository
๐ง Share with the Laravel community
๐ Report issues & suggestions
License
MIT License. See LICENSE for details.
