Skip to content

About

A collection handy helper functions for your laravel ecommerce projects

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

simtabi/lacommerce

Tests License: MIT

Two badges, not four: the package is not on Packagist yet, so there is no registry version to show, and there is no static-analysis workflow.

Handy helper generators for Laravel e-commerce projects — auto-generate unique SKUs, order numbers, and ticket numbers on your Eloquent models via the HasSku, HasOrderNumber, and HasTicketNumber traits, each configurable globally or per model and fully replaceable.

Compatible with PHP ^8.4.1 || ^8.5 and Laravel 12 or 13.

Install

composer require simtabi/lacommerce

Quick start guide and usage

Getting started

The service provider is auto-discovered and the defaults work without a config file. Give each model the destination column its trait writes to (sku, order_number or ticket_number) in your own migration. To change the defaults, publish the config to config/simtabi/lacommerce.php:

php artisan vendor:publish --tag=simtabi::lacommerce-config

Usage

use Illuminate\Database\Eloquent\Model;
use Simtabi\Lacommerce\Traits\HasSku;

class Product extends Model
{
    use HasSku;
}

$product = Product::create(['name' => 'Laravel is Awesome']);

echo $product->sku; // "LAR-8056449213"
use Illuminate\Database\Eloquent\Model;
use Simtabi\Lacommerce\Traits\HasOrderNumber;

class Order extends Model
{
    use HasOrderNumber;
}

echo Order::create(['name' => 'Web order'])->order_number; // "ORD-3920571846"

To generate a value without a model, call Identifiers directly:

use Simtabi\Lacommerce\Supports\Identifiers;

Identifiers::sku('Laravel is Awesome');    // "LAR-8056449213"
Identifiers::orderNumber('INV', '/');      // "INV/3920571846"
Identifiers::ticketNumber('Support');      // "SUP-1749302865"

The full walkthrough is in docs/getting-started.md; everything else is in the Documentation index.

Documentation

Full documentation is at opensource.simtabi.com/documentation/simtabi/lacommerce — installation, getting started, each generator trait, and configuration.

Credits

The SKU-generation approach builds on Cyrill Kalita / binary-cats' work, plus all contributors.

Contributing & security

Issues and PRs are welcome — see CONTRIBUTING.md. Report vulnerabilities per SECURITY.md (security@simtabi.com); participation follows the Code of Conduct.

License

MIT © Simtabi LLC. See LICENSE.

About

A collection handy helper functions for your laravel ecommerce projects

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages