laravel-dpd maintained by ginkida
Laravel DPD API Wrapper
Allows you to:
- Find a City by query string
- Find a Street by City ID and query string
- Find a City that has Receive Points / Terminals
- Find Receive Points / Terminals
- Find Terminals
- Calculate a delivery
No Database required
If you did research of DPD API you must know, that they suppose you to fetch data files with cities, terminals and streets and manage all of it by your own. However, with this package, there is no need for that.
Pre-requirements
You need to get DPD API key, user, login and password. Key can be obtained in your cabinet at https://www.dpd.ru/ols/order/personal/integrationKey.do2
Installation
Configuration
This package has a few configuration values:
If you only need to use DPDClient, you may completely skip this configuration. Otherwise, you can use default options and specify some data in .env file:
- DPD_KEY
- DPD_USER
- DPD_LOGIN
- DPD_PASSWORD
To make full use of predefined routes, you will need to publish the config:
Now you can change routes prefix and middleware to whatever you need
Use Case #1
After installing, you may just import the client
Firstly let's initialize and get a session. Session is required for a few methods.
Now we can use these methods:
Delivery Object
To build a Delivery object you will need to pass an array to fromArray() method just like that:
Available countries
If you need to specify a country you need to use one of these codes:
Available services
If you need to specify a service you need to use one of these codes:
Use Case #2
There are some predefined routes, that will be merged with your routes as well. You may check it by using
It actually exposes the same methods to the routes, so it should be pretty clear on how to use it.
For more information on how to use it, please check out src/ folder.