Download the PHP package carllee1983/newebpay-logistics without Composer
On this page you can find all versions of the php package carllee1983/newebpay-logistics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download carllee1983/newebpay-logistics
More information about carllee1983/newebpay-logistics
Files in carllee1983/newebpay-logistics
Package newebpay-logistics
Short Description NewebPay Logistics Integration PHP SDK. Supports various logistics methods including CVS pickup, home delivery, and more.
License MIT
Homepage https://github.com/CarlLee1983/newebpay-logistics
Informations about the package newebpay-logistics
NewebPay Logistics Integration PHP SDK
English
A PHP SDK for integrating with the NewebPay Logistics API (藍新金流物流 API). This package simplifies the process of creating transactions, selecting stores (CVS), querying orders, and printing shipping labels.
Features
- Easy Integration: Simple and intuitive API for common logistics operations.
- Framework Agnostic: Works with any PHP project (bundled with Laravel support).
- Type Safety: Utilizes PHP encapsulation to ensure data validity.
- Frontend Friendly: Built-in support for generating HTML forms for frontend frameworks (Vue, React, etc.).
Requirements
- PHP ^8.1
ext-jsonextensionext-opensslextension
Installation
Install via Composer:
Configuration
Initialize the library with your NewebPay Logistics credentials.
Parameters
| Parameter | Application | Description |
|---|---|---|
$merchantId |
Required | Your Shop ID (商店代號) provided by NewebPay. |
$hashKey |
Required | Hash Key (HashKey) for encryption. |
$hashIV |
Required | Hash IV (HashIV) for encryption. |
$serverUrl |
Optional | API Base URL. Default is testing env: https://ccore.newebpay.com/API/Logistic. |
Laravel Integration
This package includes a Service Provider and Facade for seamless Laravel integration.
1. Installation
Publish the configuration file:
2. Configuration
Add the following variables to your .env file:
3. Usage via Facade
You can use the NewebPayLogistics facade anywhere in your Laravel application.
Usage
1. Map Interface (電子地圖)
Redirect the user to the logistics provider's map interface to select a store (7-11, FamilyMart, etc.).
1-1. Frontend Integration (Vue/React)
If you are using a decoupled architecture, return the form data as JSON.
2. Create Order (建立物流訂單)
Create a logistics order for B2C or C2C transactions.
3. Query Order (查詢物流訂單)
Query the status of an existing order.
Examples
Check the examples/ directory for complete vanilla PHP scripts:
- Map Operation
- Create Order
- Query Order
- Print Order
- Laravel Integration
API Reference
For detailed API documentation, please refer to the files in the doc/ directory:
- English API Reference
- Traditional Chinese API Reference
FAQ
Q: How do I change the environment to Production?
A: By default, NewebPayLogistics::create() uses the testing URL. Pass the production URL as the 4th argument, or set NEWEBPAY_LOGISTICS_SERVER_URL in Laravel .env.
Q: Can I use this without Laravel? A: Yes! The package is framework-agnostic. See the Configuration section.
Q: I get a "Validation Validation" error. A: Ensure all required fields are set. The SDK validates the request parameters before generating the payload.
Q: I get a "Check Value Error" or Decryption failure. A: This usually means your Merchant ID, Hash Key, or Hash IV are incorrect. Please double check them. Also ensure there are no extra spaces in your keys. In some cases, ensure your input data doesn't contain encoded characters that might mess up the length calculation.
Development
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
MIT
All versions of newebpay-logistics with dependencies
ext-json Version *
ext-openssl Version *
guzzlehttp/guzzle Version ^7.0
psr/log Version ^3.0