承接 vivek-mistry/laravel-inventory-core 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vivek-mistry/laravel-inventory-core

最新稳定版本:1.0.0

Composer 安装命令:

composer require vivek-mistry/laravel-inventory-core

包简介

Core stock & inventory engine for Laravel applications

README 文档

README

Laravel Inventory Core

📦 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

🤝 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.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-20