https://github.com/cable8mm/good-code
Create a general code specification for building a WMS (Warehouse Management System), and specify parsers and implementation guidelines.
https://github.com/cable8mm/good-code
code-standards goods product-code receipt warehouse wms
Last synced: 22 days ago
JSON representation
Create a general code specification for building a WMS (Warehouse Management System), and specify parsers and implementation guidelines.
- Host: GitHub
- URL: https://github.com/cable8mm/good-code
- Owner: cable8mm
- License: mit
- Created: 2020-05-22T06:22:01.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-24T17:54:27.000Z (about 1 year ago)
- Last Synced: 2025-10-08T07:36:15.230Z (6 months ago)
- Topics: code-standards, goods, product-code, receipt, warehouse, wms
- Language: PHP
- Homepage: https://www.palgle.com/good-code/
- Size: 197 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Good Code Parser
[](https://github.com/cable8mm/good-code/actions/workflows/code-style.yml)
[](https://github.com/cable8mm/good-code/actions/workflows/run-tests.yml)





A robust code specification is crucial within the commercial market industry, especially for online stores like Amazon. The integration of online stores with Warehouse Management Systems (WMS) is essential as both systems handle extensive seller and product data. Therefore, we recommend implementing a solid structure and providing robust support for these systems.
These specifications cover a variety of online stores, including Coupang, 11th Street, Naver Storefarm, and many others for a while.
We have provided the API Documentation on the web. For more information, please visit ❤️
## Features
- [x] Normal good code parser
- [x] Gift good code parser
- [x] Set good code parser
- [x] Complex good code parser
- [x] Option Good code parser(No code, it matched by name)
- [x] Receipt code parser
- [x] Location code parser
- [x] SKU parser
## Install
```bash
composer require cable8mm/good-code
```
## Usage
### Production codes for Laravel
Visit repository -
```php
data->get('sellerGoodsCd')) == GoodCodeType::OPTION) {
$code = GoodCode::of(
$this->data->get('sellerGoodsCd'),
option: $this->data->get('option'),
callback: function ($key, $option) {
return OptionGood::findMasterCode($key)->option($option)->first()->masterCode();
}
)->code();
$this->data->put('masterGoodsCd', $code);
}
```
```php
data->get('sellerGoodsCd')) == GoodCodeType::COMPLEX
|| GoodCodeType::of($this->data->get('sellerGoodsCd')) == GoodCodeType::GIFT
) {
$code = GoodCode::of(
$this->data->get('sellerGoodsCd'),
callback: function ($key) {
return SetGood::findComCode($key)->master_code;
}
)->code();
$this->data->put('masterGoodsCd', $code);
}
```
### Example codes
#### `set-code`
```php
value();
//=> ['7369'=>4,'4235'=>6]
print GoodCode::setCodeOf(['1234' => 2, '5678' => 1,])->code();
//=> 'set1234x2ZZ5678x1'
```
#### `complex-code`
```php
'123'];
return $a[$key];
})->value();
//=> '123'
```
#### `gift-code`
```php
'456',
];
return $a[$key];
});
//=> '456'
```
#### `option-code`
> [!TIP]
> `option-code` are matching with **both** `option-code` **and** `option-good-option` name. Unfortunately all of online shops like Coupang and 11st have not send any key for option to sellers.
```php
[
'Super Smash Bros. Ultimate' => 'COM4',
'Animal Crossing: New Horizons' => '3124',
'The Legend of Zelda: Tears of the Kingdom' => '1234',
'Call of Duty®: Black Ops 6' => '2314',
'Grand Theft Auto V' => '43123',
'42342', 'name' => 'Marvel\'s Spider-Man 2',
],
];
return $a[$key][$option];
})->value();
//=> '3124'
```
### Special value object - `SetGood`
```php
goods();
//=> ['43' => 3, '253' => 3]
print SetGood::ofArray(['43' => 3, '253' => 3])->code();
//=> SET43x3zz253x3
```
### Receipt Code
```php
code;
//=> PO-20250312-0001
print ReceiptCode::of('PO-20250312-0001')->prefix;
//=> PO
print ReceiptCode::of('PO-20250312-0001')->ymd;
//=> 20250312
print ReceiptCode::of('PO-20250312-0001')->number;
//=> 0001
print ReceiptCode::of('PO-20250312-0001')->nextCode();
//=> PO-20250312-0002
print ReceiptCode::of()->nextCode();
//=> PO-[Today's ymd]-0001
print ReceiptCode::of(prefix: 'CT')->nextCode();
//=> CT-[Today's ymd]-0001
```
### Location Code
```php
print LocationCode::of(warehouse: 'AUK', rack: 'R3', shelf: 'S32')->locationCode();
print LocationCode::of(['warehouse' => 'AUK', 'rack' => 'R3', 'shelf' => 'S32')->locationCode();
print LocationCode::of(warehouse: 'AUK', rack: 'R3', shelf: 'S32'); //` Stringable` supported
//=> AUK-R3-S32
```
### SKU
```php
print Sku::of(code: 123, prefix: 'PO'); //=> PO123
print Sku::of(123); //=> 123
print Sku::of(123, prefix: 'PO'); //=> PO123
```
## Formatting
```sh
composer lint
```
## Test
```sh
composer test
```
## Support codes
| Type | Notation | Description | Implement |
| -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `Normal Code` | - | Match only one good | Yes |
| `Set Code` | SET | Match one more good, max 255 characters | Yes |
| `Complex Code` | COM | Shorten code for `Set Code` | Yes |
| `Gift Code` | GIF | Alias `Complex Code` | Yes |
| `Option Code` | OPT | Very complicated code. Not mastercode, but code + search name.(eq. wemakeprice, naver petWindow and all most OpenMarket options) | Yes |
## License
The Phpunit Start Kit is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).