Search by

itmosoft / laravel-suppliers

adeelrao007

Supplier profiles, contacts, and supplier-product sourcing relationships for Laravel applications, with supplier-specific SKUs, costs, lead times, and preferred supplier support.

Package info

github.com/ITMOSOFT/laravel-suppliers

pkg:composer/itmosoft/laravel-suppliers

Statistics

Installs: 15

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-17 11:41 UTC

This package is auto-updated.

Last update: 2026-11-17 11:43:35 UTC


README

Supplier profiles, contact management, and supplier-product sourcing relationships for Laravel applications.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13

Installation

composer require itmosoft/laravel-suppliers
php artisan vendor:publish --tag=itmosoft-suppliers-config
php artisan vendor:publish --tag=itmosoft-suppliers-migrations
php artisan migrate

Create a supplier

use ItmoSoft\Suppliers\Services\SupplierManager;

$supplier = app(SupplierManager::class)->create([
    'name' => 'Acme Supplies',
    'legal_name' => 'Acme Supplies Limited',
    'registration_number' => 'REG-100',
    'tax_number' => 'TAX-200',
    'country_code' => 'PK',
    'is_verified' => true,
]);

Add supplier contacts

$contact = app(SupplierManager::class)->addContact(
    supplier: $supplier,
    attributes: [
        'name' => 'Ali Khan',
        'title' => 'Sales Manager',
        'email' => 'ali@example.com',
        'phone' => '+92...',
    ],
    primary: true,
);

Setting a new primary contact clears the previous primary contact for that supplier.

Link suppliers to products

Add the HasSuppliers trait to your product model:

use Illuminate\Database\Eloquent\Model;
use ItmoSoft\Suppliers\Concerns\HasSuppliers;

class Product extends Model
{
    use HasSuppliers;
}

Attach a supplier and its commercial terms:

$supplierProduct = app(SupplierManager::class)->attachProduct(
    supplier: $supplier,
    product: $product,
    attributes: [
        'supplier_sku' => 'AC-WIDGET-01',
        'unit_cost' => '12.5000',
        'currency' => 'PKR',
        'minimum_order_quantity' => '10',
        'lead_time_days' => 7,
        'is_preferred' => true,
    ],
);

A product can have multiple suppliers. Marking one supplier-product link as preferred clears the preferred flag from other supplier links for that same product.

The same supplier-product link is updated when attachProduct is called again for the same supplier and product pair.

Query supplier relationships

$product->supplierProducts;
$supplier->products;
$supplier->activeProducts;
$supplier->contacts;
$supplier->primaryContact();

Supplier status

app(SupplierManager::class)->setStatus($supplier, 'suspended');

Supported statuses: active, suspended, inactive.

Configuration

Published file: config/itmosoft-suppliers.php.

  • suppliers_table
  • contacts_table
  • supplier_products_table
  • statuses
  • default_status
  • default_currency

Scope and security

This package manages supplier records, contacts, and supplier-specific product sourcing terms. It does not implement supplier portals, procurement workflows, purchase orders, inventory receiving, supplier payments, automated feed imports, contract management, or supplier verification procedures. is_verified is an application-managed status flag; this package does not perform external verification.

Applications remain responsible for authorization and tenant isolation.

Testing

composer install
composer test

License

MIT. See LICENSE.