PHPackages                             xiaodi/sku - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xiaodi/sku

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xiaodi/sku
==========

sku package for vant

12PHP

Since Aug 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/edenleung/sku)[ Packagist](https://packagist.org/packages/xiaodi/sku)[ RSS](/packages/xiaodi-sku/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Sku
===

[](#sku)

安装
--

[](#安装)

```
$ composer require xiaodi/sku:dev-master
```

使用
--

[](#使用)

```
use xiaodi\Sku\Service\SkuAttr;
use xiaodi\Sku\Service\SkuGoods;

use app\model\SkuAttr;
use app\model\SkuGoods;

$sku_a = new SkuAttr(new \app\model\SkuAttr);
$sku_a->create('内存');
$sku_a->create('存储');

$sku_a->create('4g', [
	'pid' => 1
]);

$sku_a->create('128G', [
	'pid' => 2
]);

$sku_a->create('8g', [
	'pid' => 1
]);

$sku_a->create('256G', [
	'pid' => 2
]);

$sku_g = new SkuAttr(new \app\model\SkuGoods);

$sku = new Sku($sku_g, $sku_a);

// add
$mem = $sku_a->name('4g');
$storage = $sku_a->name('128G');
$sku->goods(1)->attrs($mem, $storage)->stock(1000)->price(1999)->add();

// update
$mem = $sku_a->name('8g');
$storage = $sku_a->name('256G');
$sku->goods(1)->attrs($mem, $storage)->stock(2000)->price(2999)->update(1);

// delete
$sku->delete(1);

// vant
$data = $sku->goods(1)->vant();
dump($data);
```

Tables
------

[](#tables)

```
CREATE TABLE `sku_goods` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`goods_id` INT(11) NOT NULL,
	`sku_attrs` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`price` INT(11) NOT NULL DEFAULT '0',
	`stock_num` INT(11) NOT NULL DEFAULT '0',
	`create_time` INT(11) NOT NULL DEFAULT '0',
	`update_time` INT(11) NOT NULL DEFAULT '0',
	`delete_time` INT(11) NOT NULL DEFAULT '0',
	PRIMARY KEY (`id`)
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB;
```

```
CREATE TABLE `sku_attr` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`pid` INT(11) NULL DEFAULT '0',
	`create_time` INT(11) NOT NULL DEFAULT '0',
	`update_time` INT(11) NOT NULL DEFAULT '0',
	`delete_time` INT(11) NOT NULL DEFAULT '0',
	PRIMARY KEY (`id`),
	UNIQUE INDEX `name_pid` (`name`, `pid`)
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
;
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/81fb8c1760e123896567a7795983521f3f6c46a2c041613a176f83603e5e52e9?d=identicon)[xiaodi](/maintainers/xiaodi)

---

Top Contributors

[![edenleung](https://avatars.githubusercontent.com/u/31346973?v=4)](https://github.com/edenleung "edenleung (7 commits)")

---

Tags

skuthinkphpvant

### Embed Badge

![Health badge](/badges/xiaodi-sku/health.svg)

```
[![Health](https://phpackages.com/badges/xiaodi-sku/health.svg)](https://phpackages.com/packages/xiaodi-sku)
```

###  Alternatives

[magefan/module-blog-m22

Fixes for Blog on Magento 2.2.x

2169.3k](/packages/magefan-module-blog-m22)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
