PHPackages                             jonathanbak/navershopep - 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. jonathanbak/navershopep

ActiveLibrary[API Development](/categories/api)

jonathanbak/navershopep
=======================

Naver Shopping EP3 PHP Library

v1.0.3(4y ago)010MITPHPPHP &gt;=5.6.0

Since May 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/jonathanbak/NaverShopEp)[ Packagist](https://packagist.org/packages/jonathanbak/navershopep)[ Docs](http://github.com/jonathanbak/NaverShopEp)[ RSS](/packages/jonathanbak-navershopep/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

NaverShopEp
===========

[](#navershopep)

네이버쇼핑 상품정보연동 EP3.0 파일 생성 라이브러리 입니다. 국내에서 제공되는 php 연동 API 샘플이 다른 개발 언어에 비해 항상 부족한것 같아 php 동지들을 위해 부족하지만 공개해봅니다.

Install
-------

[](#install)

```
$ composer require jonathanbak/navershopep
```

Start
-----

[](#start)

네이버쇼핑 연동시 사용할 EP 테이블 생성

```
CREATE TABLE `nshop_epitem` (
    `ne_uid` int(11) NOT NULL COMMENT '고유 상품 번호',
    `ne_item_hash` varchar(255) DEFAULT NULL COMMENT '변경체크값',
    `ne_send_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '전송 날짜',
    `ne_reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '전송데이터 등록일',
    PRIMARY KEY (`ne_uid`),
    KEY `ix_nshop_epitem_ne_uid_hash` (`ne_uid`,`ne_item_hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```

Sample Test
-----------

[](#sample-test)

샘플 소스 복사하여 참고하세요.

```
$ cp -rp ./vendor/jonathanbak/navershopep/samples ./samples

$ cat ./samples/README.md
```

Usage
-----

[](#usage)

1. 각 쇼핑몰에 맞게 NaverShopEp\\Shop\\AbstractLists, NaverShopEp\\Shop\\AbstractItem 을 상속받아 클래스 작성해주세요.
2. 지정된 연동시간에 맞춰 실행할 EP생성 스크립트 파일을 만들고 cron 등에 등록하여 ep파일을 생성합니다.
3. 네이버쇼핑 "쇼핑몰 상품DB URL" 에 등록할 파일 만드셔서 ep파일을 읽어 데이터를 제공합니다.

#### 1. 각 쇼핑몰 에 맞게 커스텀 클래스 생성하기

[](#1-각-쇼핑몰-에-맞게-커스텀-클래스-생성하기)

1. Lists 만들기, NaverShopEp\\Shop\\AbstractLists 를 상속

```
use NaverShopEp\Shop\AbstractLists;

class ShopLists extends AbstractLists {

    /**
     * 주문판매상태 고려 전송하고자 하는 상품 선택 쿼리
     * 전송되는 정보 고려 (변경시 업데이트 필요) item_hash 작성
     * @return string
     */
    public function queryAll()
    {
        $query = "SELECT s_idx as uid, s_goods_name, s_img_url, s_price, IF(s_stock>0,1,0) as is_stock, s_status, s_last_update,
                        md5(CONCAT(s_goods_name, s_img_url, s_price, s_status, IF(s_stock>0,1,0))) as item_hash
                FROM shop_item WHERE s_status = 1 AND s_nshop_flag = 'Y' LIMIT 5
                ";
        return $query;
    }
}
```

2. Item 만들기, NaverShopEp\\Shop\\AbstractItem 을 상속

```
/**
 * Class ShopLists
 * 각 쇼핑몰에 맞게 NaverShopEp\Shop\AbstractItem 확장하여 데이터 맞춰주시면 됩니다.
 */
class ShopItem extends AbstractItem {

    public function getId()
    {
        return $this->data['uid'];
    }

    public function getCategory_name1()
    {
        return '카테고리1';
    }

    public function getImage_link()
    {
        return 'http://sample.com'.$this->data['s_img_url'];
    }

    public function getLink()
    {
        return 'http://sample.com/goods/detail?gno='.$this->data['uid'];
    }

    public function getMobile_link()
    {
        return 'http://sample.com/goods/detail?gno='.$this->data['uid'];
    }

    public function getPrice_pc()
    {
        return $this->data['s_price'];
    }

    public function getShipping()
    {
        return 0;
    }

    public function getTitle()
    {
        return $this->data['s_goods_name'];
    }
}
```

#### 2. ep 파일 만들기

[](#2-ep-파일-만들기)

1. 전체 상품 EP 파일 생성

```
use NaverShopEp\Ep\Full;
use NaverShopEp\Exception;
use NaverShopEp\ItemManage;
use NaverShopEp\MakeHandler;
use NaverShopEp\Product;

//db커넥
$dbConn = new \mysqli($host, $user, $password, $dbName, $dbPort);

if($dbConn->connect_errno){
    echo '[연결실패] : '.$dbConn->connect_error.'';
} else {
    //echo '[연결성공]';
}

$MakeHandler = new MakeHandler();
$MakeHandler->setEpDir("tmp");
$MakeHandler->createFileStart();
$ShopLists = new ShopLists();
$ItemManager = new ItemManage();
$query = $ItemManager->getAllQuery($ShopLists);
//1. 쿼리 실행
$result = $dbConn->query($query) or die($dbConn->error);

$ProductProxy = new Product();
//전체 목록 체크하여 데이터 생성
while($data = $result->fetch_array()) {
    try {
        $NaverShopEpProduct = new Full();  //EP 풀버전
        $ProductProxy->setEp($NaverShopEpProduct);
        $ShopItem = new ShopItem($data);
        $ProductProxy->setShop($ShopItem);
        $ProductProxy->match();
        $MakeHandler->createFileContent($ProductProxy->get());

        $registEpItemData = ['ne_uid'=>$data['uid'], 'ne_item_hash'=>$data['item_hash']];
        $addQuery = $ItemManager->add($registEpItemData);
        $dbConn->query($addQuery);
        //쿼리 실행
    } catch (Exception $e) {
        var_dump($e->getMessage());
    }
}
```

2. 요약 EP 파일 생성

```
use NaverShopEp\Ep\Simple;
use NaverShopEp\Exception;
use NaverShopEp\ItemManage;
use NaverShopEp\MakeHandler;
use NaverShopEp\Product;

//db커넥
$dbConn = new \mysqli($host, $user, $password, $dbName, $dbPort);

if($dbConn->connect_errno){
    echo '[연결실패] : '.$dbConn->connect_error.'';
} else {
    //echo '[연결성공]';
}

$MakeHandler = new MakeHandler(MakeHandler::TYPE_SIMPLE);
$MakeHandler->setEpDir("tmp");
$MakeHandler->createFileStart();
$ShopLists = new ShopLists();
$ItemManager = new ItemManage();
//1. 변경된 상품 불러오기
$query = $ItemManager->getChangeListQuery($ShopLists);
$result = $dbConn->query($query) or die($dbConn->error);
$ProductProxy = new Product();
$createDateTime = date("Y-m-d H:i:s");  //상품정보 생성 시각
while($data = $result->fetch_array()) {
    try {
        $NaverShopEpProduct = new Simple();  //EP 요약버전
        $ProductProxy->setEp($NaverShopEpProduct);
        if ($data['is_stock'] == 0) {
            //품절된 상품 삭제
            $ShopItem = new ShopItem($data);
            $ProductProxy->setShop($ShopItem);
            $ProductProxy->delete($createDateTime);//상품정보 생성 시각
            $ProductProxy->match();
            echo $ProductProxy->get();
            $MakeHandler->createFileContent($ProductProxy->get());

            $registEpItemData = ['ne_uid'=>$data['uid'], 'ne_item_hash'=>$data['item_hash']];
            $addQuery = $ItemManager->add($registEpItemData);
            $dbConn->query($addQuery);
        } else {
            //변경된 상품 업데이트
            $ShopItem = new ShopItem($data);
            $ProductProxy->setShop($ShopItem);
            $ProductProxy->update($createDateTime);//상품정보 생성 시각
            $ProductProxy->match();
            echo $ProductProxy->get();
            $MakeHandler->createFileContent($ProductProxy->get());

            $registEpItemData = ['ne_uid'=>$data['uid'], 'ne_item_hash'=>$data['item_hash']];
            $addQuery = $ItemManager->add($registEpItemData);
            $dbConn->query($addQuery);
        }
        //쿼리 실행
    } catch (Exception $e) {
        var_dump($e->getMessage());
    }
}

//2. 추가된 상품 불러오기
$query = $ItemManager->getNewListQuery($ShopLists);
$result = $dbConn->query($query) or die($dbConn->error);
while($data = $result->fetch_array()) {
    try {
        $NaverShopEpProduct = new Simple();  //EP 요약버전
        $ProductProxy->setEp($NaverShopEpProduct);
        //변경된 상품 업데이트
        $ShopItem = new ShopItem($data);
        $ProductProxy->setShop($ShopItem);
        $ProductProxy->insert($createDateTime);//상품정보 생성 시각
        $ProductProxy->match();
        echo $ProductProxy->get();
        $MakeHandler->createFileContent($ProductProxy->get());

        $registEpItemData = ['ne_uid'=>$data['uid'], 'ne_item_hash'=>$data['item_hash']];
        $addQuery = $ItemManager->add($registEpItemData);
        $dbConn->query($addQuery);

        //쿼리 실행
    } catch (Exception $e) {
        var_dump($e->getMessage());
    }
}
```

#### EP 파일 읽기

[](#ep-파일-읽기)

실제 네이버쇼핑 상품DB URL 에 연동할 EP 읽기 소스 입니다.

```
use NaverShopEp\Ep\Full;
use NaverShopEp\Ep\Simple;
use NaverShopEp\MakeHandler;

try{
    //요청 시간에 따라 전체 EP, 요약 EP로 나눠서 뿌려준다 EP3.0에서 변경된 요소
    if(date('G')>=10){
        $NhnEpMakeHandler = new MakeHandler( MakeHandler::TYPE_SIMPLE );
        $NhnEpMakeHandler->setEpDir("tmp");
        $NhnEpMakeHandler->setFileHeader(new Simple());
        $contents = $NhnEpMakeHandler->readFile();
        if($contents){
            echo $contents;
        }
    }else{
        $NhnEpMakeHandler = new MakeHandler( MakeHandler::TYPE_FULL );
        $NhnEpMakeHandler->setEpDir("tmp");
        $NhnEpMakeHandler->setFileHeader(new Full());
        $contents = $NhnEpMakeHandler->readFile();
        if($contents){
            echo $contents;
        }
    }

}catch(Exception $e){
    var_dump($e->getMessage());
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

1824d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.3.0

v1.0.2PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/dedc20581039074349473e7d668ee3c563228045644fa1bb14e9529034ffabd3?d=identicon)[Jonathan Bak](/maintainers/Jonathan%20Bak)

---

Top Contributors

[![jonathanbak](https://avatars.githubusercontent.com/u/3095731?v=4)](https://github.com/jonathanbak "jonathanbak (2 commits)")

---

Tags

Naver Shoppingep3nshop ep

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jonathanbak-navershopep/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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