PHPackages                             goodcatch/guanyierp - 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. [API Development](/categories/api)
4. /
5. goodcatch/guanyierp

ActiveLibrary[API Development](/categories/api)

goodcatch/guanyierp
===================

make guanyierp Api easier

v1.0.1(6y ago)03692MITPHPPHP &gt;=7.0CI failing

Since Sep 25Pushed 6y ago1 watchersCompare

[ Source](https://github.com/allenwakeup/guanyierp)[ Packagist](https://packagist.org/packages/goodcatch/guanyierp)[ RSS](/packages/goodcatch-guanyierp/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Guanyi ERP API Library
======================

[](#guanyi-erp-api-library)

Make Guanyi ERP API easier

Installation
------------

[](#installation)

```
composer require goodcatch/guanyierp

php artisan vendor:publish --tag guanyi-config

```

Configuration
-------------

[](#configuration)

In Configuration file `config/guanyi.php`, checkout following configuration

```
'auth' => [
    'appkey' => env('GUANYI_API_APP_KEY', ''),
    'sessionkey' => env('GUANYI_API_SESSION_KEY', ''),
    'secret' => env('GUANYI_API_SECRET', '')
]

```

And then add environment key-values to `.env` file

```
GUANYI_API_APP_KEY=xxxxxxx
GUANYI_API_SESSION_KEY=xxxxxxx
GUANYI_API_SECRET=xxxxxxx
GUANYI_API_TIME_OUT=2
```

Also, the optional key-value `GUANYI_API` default to [API URL](http://v2.api.guanyierp.com/rest/erp_open)can be set in others URLs

```
GUANYI_API=http://v2.api.guanyierp.com/rest/erp_open
```

Usage
-----

[](#usage)

For examples:

```
use Goodcatch\Guanyi\Facades\Guanyi;

public function xxx () {

    // get product by product code
    $model = Guanyi::getProducts ('Product Code');

    // get products, $products->data presents all of product list
    $model = Guanyi::getProducts ();

    // checkout whether success or not
    if ($products->success)
    {

        // go through list models
        foreach ($model->data as $index => $product)
        {
            // get product fields $product->xxx
        }

    } else {

        dd ($model->errorCodel); // error code
        dd ($model->errorDesc); // error message
        dd ($model->subErrorDesc); // additional error message
        dd ($model->requestMethod); // guanyi ERP method name

    }
}
```

```
Route::get('/guanyi/products', function () {

    // get products by code, with page_no=1, and page_size=9999
    $model = Goodcatch\Guanyi\Facades\Guanyi::getProducts ('Product Code', [], 1, 9999);

    if ($model->success)
    {
        return $model->data;
    } else {

        // error message from guanyi api
        // for example: page_size=9999 is out of given range 1~99
        return $model->errorDesc;
    }

});

// got library exceptions
$model = Goodcatch\Guanyi\Facades\Guanyi::getProducts ();

if (! $model->success && isset ($model->exception) && is_array ($model->exception))
{
    foreach ($model->exception as $ex)
    {
        // Note: Increace GUANYI_API_TIME_OUT while keep getting exception.
        // string $ex
    }

}

// use criteria, note that get started with 'query' before 'critieria'
Goodcatch\Guanyi\Facades\Guanyi::query ()
    ->criteria ('start_date', '2019-09-24 00:00:00')
    ->criteria ('end_date', '2019-09-25 23:59:59')
    // use httpclient
    ->setHttpClient (new GuzzleHttp\Client ([
        // options
        'timeout' => 2
    ]))
    ->getProducts ([
        // overrite criteria
        'start_date' => '2019-09-25 00:00:00'
    ]);

```

Methods
-------

[](#methods)

### 基础信息

[](#基础信息)

#### 店铺查询（gy.erp.shop.get）

[](#店铺查询gyerpshopget)

##### getShops

[](#getshops)

获取店铺列表

##### getWarehouses

[](#getwarehouses)

获取仓库列表

---

### 商品管理

[](#商品管理)

#### 商品查询（gy.erp.items.get）

[](#商品查询gyerpitemsget)

##### getProducts

[](#getproducts)

获取商品列表

---

### 采购管理

[](#采购管理)

#### 采购订单查询（gy.erp.purchase.get）

[](#采购订单查询gyerppurchaseget)

##### getPurchases

[](#getpurchases)

获取采购订单列表

##### getPurchasesByWarehouseCode

[](#getpurchasesbywarehousecode)

根据仓库代码获取采购订单列表

##### getPurchasesBySupplierCode

[](#getpurchasesbysuppliercode)

根据供应商代码获取采购订单列表

---

### 订单管理

[](#订单管理)

#### 发货单查询（gy.erp.trade.deliverys.get）

[](#发货单查询gyerptradedeliverysget)

##### getTradeDeliverys

[](#gettradedeliverys)

获取发货单列表

##### getTradeDeliverysByCode

[](#gettradedeliverysbycode)

根据单据编号获取发货单列表

##### getTradeDeliverysByWarehouse

[](#gettradedeliverysbywarehouse)

根据仓库代码获取发货单列表

##### getTradeDeliverysByShop

[](#gettradedeliverysbyshop)

根据店铺代码获取发货单列表

##### getTradeDeliverysByOuter

[](#gettradedeliverysbyouter)

根据平台单号获取发货单列表

Licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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.

###  Release Activity

Cadence

Every ~10 days

Total

2

Last Release

2460d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d2591286728fbc498decd82dc3b6707bf80ee949c6ef132406e35498cc1c990?d=identicon)[allenwakeup](/maintainers/allenwakeup)

### Embed Badge

![Health badge](/badges/goodcatch-guanyierp/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M154](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)

PHPackages © 2026

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