PHPackages                             cable8mm/waybill - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. cable8mm/waybill

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

cable8mm/waybill
================

A lightweight PHP library for generating PDF waybills with ease.

v1.3.2(1y ago)1329MITPHPPHP ^8.2CI passing

Since Feb 12Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/cable8mm/waybill)[ Packagist](https://packagist.org/packages/cable8mm/waybill)[ Docs](https://github.com/cable8mm/waybill)[ RSS](/packages/cable8mm-waybill/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (6)Dependencies (7)Versions (7)Used By (0)

PDF Waybill Generator
=====================

[](#pdf-waybill-generator)

[![Coding Style Actions](https://github.com/cable8mm/waybill/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/waybill/actions/workflows/code-style.yml/badge.svg)[![Run Tests Actions](https://github.com/cable8mm/waybill/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/waybill/actions/workflows/run-tests.yml/badge.svg)[![Latest Version on Packagist](https://camo.githubusercontent.com/23b08250f293e46fd390c6f5ef821abfdf7470758677ce5626b84fa5f57f04c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361626c65386d6d2f77617962696c6c2e737667)](https://packagist.org/packages/cable8mm/waybill)[![Packagist Dependency Version](https://camo.githubusercontent.com/71c75a3e71d13735f9294da50d0de4ecc3d07aebc5e2fd78d183288cbffd2bd2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f77617962696c6c2f7068703f6c6f676f3d504850266c6f676f436f6c6f723d776869746526636f6c6f723d373737424234)](https://packagist.org/packages/cable8mm/waybill)[![Total Downloads](https://camo.githubusercontent.com/895a850b7e4ab1d34449ffd13e10cb89fc84d607bf6d1404d4428615190fb141/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361626c65386d6d2f77617962696c6c2e737667)](https://packagist.org/packages/cable8mm/waybill)[![Packagist Stars](https://camo.githubusercontent.com/b924c2cbd6ab59c1fcd4b707bd68e37400dc1e2296c9a3efbf01cbefe1d67d74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6361626c65386d6d2f77617962696c6c)](https://github.com/cable8mm/waybill/stargazers)

PHP로 PDF 운송장을 손쉽게 생성할 수 있는 라이브러리입니다. CJ대한통운을 기본으로 지원하며, 바코드 생성, 송신자/수신자 정보, 커스터마이징 가능한 레이아웃을 제공합니다. 쇼핑몰이나 물류 시스템에서 배송 레이블 생성을 자동화하는 데 적합합니다.

설치
--

[](#설치)

Composer로 설치할 수 있습니다:

```
composer require cable8mm/waybill
```

사용법
---

[](#사용법)

### 빠른 시작

[](#빠른-시작)

기본 운송장을 PDF로 저장:

```
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Waybill;

Waybill::of(ParcelService::Cj)
    ->path(realpath(__DIR__.'/../dist'))
    ->save('test.pdf');
```

운송장 데이터를 배열로 가져오기 (API 응답 또는 CSV 내보내기용):

```
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Waybill;

$waybill = Waybill::of(ParcelService::Cj)
            ->toArray();
```

### 커스텀 데이터 사용하기 (`state()`)

[](#커스텀-데이터-사용하기-state)

실제 주문 데이터로 특정 필드를 덮어씁니다:

```
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Waybill;

Waybill::of(ParcelService::Cj)
    ->state([
        'seller' => ['name' => '내회사', 'phone' => '02-1234-5678'],
        'receiver' => ['name' => '홍길동', 'phone' => '010-1234-5678'],
        'tracking_number' => 'CJ-1234-5678-9012',
    ])
    ->path(realpath(__DIR__.'/../dist'))
    ->save('waybill.pdf');
```

### 인스턴스 분리 생성 후 mpdf 주입

[](#인스턴스-분리-생성-후-mpdf-주입)

`Waybill` 인스턴스를 먼저 만들고, 나중에 `mpdf`를 주입합니다:

```
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Support\Mpdf;
use Cable8mm\Waybill\Waybill;

$mpdf = Mpdf::instance();

$waybill = Waybill::make(ParcelService::Cj)
    ->mpdf($mpdf)
    ->path(realpath(__DIR__.'/../dist'))
    ->save('test.pdf');
```

### 여러 개의 운송장 생성

[](#여러-개의-운송장-생성)

하나의 PDF 파일에 여러 장의 운송장을 저장:

```
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Support\Mpdf;
use Cable8mm\Waybill\Waybill;
use Cable8mm\Waybill\WaybillCollection;

$mpdf = Mpdf::instance();

WaybillCollection::of(mpdf: $mpdf)
    ->add(Waybill::of(ParcelService::Cj, mpdf: $mpdf))
    ->add(Waybill::of(ParcelService::Cj, mpdf: $mpdf))
    ->path(realpath(__DIR__.'/../dist'))
    ->save('collection.pdf');

// 또는 한 번에 여러 개 추가:
WaybillCollection::of(mpdf: $mpdf)
    ->add([
      Waybill::of(ParcelService::Cj, mpdf: $mpdf),
      Waybill::of(ParcelService::Cj, mpdf: $mpdf),
      ])
    ->path(realpath(__DIR__.'/../dist'))
    ->save('collection.pdf');
```

### PDF에서 특정 운송장만 추출하기

[](#pdf에서-특정-운송장만-추출하기)

여러 페이지로 된 PDF에서 원하는 페이지 하나만 잘라냅니다:

```
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Slicer;

Slicer::of(ParcelService::Cj, 1)
    ->source('source.pdf')
    ->save('one_page.pdf'); // 또는 ->download('one_page.pdf') 로 다운로드
```

### 설정

[](#설정)

`config.php` 파일에서 mPDF 설정을 관리합니다. 한글 폰트(NanumBarunGothic), 용지 크기, 여백, 워터마크 등을 설정할 수 있습니다:

```
return [
    'mode' => 'utf-8',
    'format' => 'A4',
    'custom_font_dir' => __DIR__.'/fonts',
    'custom_font_data' => [
        'nbg' => [
            'R' => 'NanumBarunGothic.ttf',
        ],
    ],
    'default_font' => 'nbg',
    // ...
];
```

### 택배사 추가하기 (커스터마이징)

[](#택배사-추가하기-커스터마이징)

UPS 같은 새 택배사를 추가하려면 `Enum`과 `Factory` 클래스를 만들어야 합니다:

1. `src/Factories/` 폴더에 `UpsFactory.php` 생성
2. `src/Enums/ParcelService.php` Enum에 `Ups` 케이스 추가
3. `factoryClass()`, `stub()`, `templateArea()` 메서드 구현
4. PDF 레이아웃을 위한 `stubs/Ups.stub` 파일 생성

### 테스트

[](#테스트)

```
composer test
```

### 변경 내역

[](#변경-내역)

자세한 내용은 [CHANGELOG](CHANGELOG.md)를 확인해주세요.

기여하기
----

[](#기여하기)

기여 방법은 [CONTRIBUTING](CONTRIBUTING.md)을 참고해주세요.

### 보안

[](#보안)

보안 관련 이슈는 Issue Tracker 대신 으로 메일 부탁드립니다.

크레딧
---

[](#크레딧)

- [Samgu Lee](https://github.com/cable8mm)
- [All Contributors](../../contributors)

라이선스
----

[](#라이선스)

MIT 라이선스입니다. 자세한 내용은 [License File](LICENSE)을 확인해주세요.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance69

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

6

Last Release

549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c910c874a0263a18f9f976273054cd45faa3ffbcba7891992f4ab52d0656dd93?d=identicon)[Sam Lee](/maintainers/Sam%20Lee)

---

Top Contributors

[![cable8mm](https://avatars.githubusercontent.com/u/2672043?v=4)](https://github.com/cable8mm "cable8mm (20 commits)")

---

Tags

barcodedeliveryfactoryfakerinvoiceparcelpdfwaybillpdfcable8mmwaybill

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cable8mm-waybill/health.svg)

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

###  Alternatives

[abydahana/aksara

Aksara is a modern, developer-friendly framework and CMS built on CodeIgniter 4, featuring rapid CRUD development, modular architecture, smart routing, flexible access control, API integration, and an AI assistant to make content management faster and smarter.

1141.2k](/packages/abydahana-aksara)[carlos-meneses/laravel-mpdf

Laravel Mpdf: Using Mpdf in Laravel to generate Pdfs.

4393.5M18](/packages/carlos-meneses-laravel-mpdf)[kartik-v/yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.

1605.8M97](/packages/kartik-v-yii2-mpdf)[contributte/pdf

Pdf response extension for Nette Framework

431.0M4](/packages/contributte-pdf)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k16](/packages/2lenet-crudit-bundle)[skeeks/cms-shop

Интернет магазин для SkeekS CMS

145.9k25](/packages/skeeks-cms-shop)

PHPackages © 2026

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