https://github.com/cable8mm/waybill
A lightweight PHP library for generating PDF waybills with ease.
https://github.com/cable8mm/waybill
barcode delivery factory faker invoice parcel pdf waybill
Last synced: 4 months ago
JSON representation
A lightweight PHP library for generating PDF waybills with ease.
- Host: GitHub
- URL: https://github.com/cable8mm/waybill
- Owner: cable8mm
- License: mit
- Created: 2025-02-08T12:26:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-16T05:37:12.000Z (over 1 year ago)
- Last Synced: 2025-03-21T20:04:48.291Z (about 1 year ago)
- Topics: barcode, delivery, factory, faker, invoice, parcel, pdf, waybill
- Language: PHP
- Homepage: http://www.palgle.com/waybill/
- Size: 1.98 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# PDF Waybill Generator


[](https://packagist.org/packages/cable8mm/waybill)
[](https://packagist.org/packages/cable8mm/waybill)
[](https://packagist.org/packages/cable8mm/waybill)
[](https://github.com/cable8mm/waybill/stargazers)
A lightweight PHP library for generating PDF waybills with ease. This package allows developers to create and customize waybills in PDF format for courier and logistics services. It supports barcode generation, sender/receiver details, and customizable layouts. Perfect for automating shipping label creation in your e-commerce or logistics applications.
## Installation
You can install the package via composer:
```bash
composer require cable8mm/waybill
```
## Usage
Save a waybill for pdf format:
```php
use Cable8mm\Waybill\Enums\ParcelService;
use Cable8mm\Waybill\Waybill;
Waybill::of(ParcelService::Cj)
->path(realpath(__DIR__.'/../dist'))
->save('test.pdf');
```
Get a waybill array:
```php
$waybill = Waybill::of(ParcelService::Cj)
->toArray()
```
Save multiple waybills for pdf format:
```php
$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');
// or
WaybillCollection::of(mpdf: $mpdf)
->add([
Waybill::of(ParcelService::Cj, mpdf: $mpdf),
Waybill::of(ParcelService::Cj, mpdf: $mpdf),
])
->path(realpath(__DIR__.'/../dist'))
->save('collection.pdf');
```
Slice the page of the waybills:
```php
Slicer::of(ParcelService::Cj, 1)
->source('source.pdf')
->save('one_page.pdf'); // or `->download('one_page.pdf')`
```
### How to customize
If you want to add another parcel service like UPS, you would need to make `Enums` and `Factory` class, for example:
1. Make `UpsFactory.php` into `src/Factories' folder.
2. Make `Enum` element into `src/Enums` folder.
### Testing
```bash
composer test
```
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email instead of using the issue tracker.
## Credits
- [Samgu Lee](https://github.com/cable8mm)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.