Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdekeizer committed Dec 7, 2019
0 parents commit 795d935
Showing 41 changed files with 4,882 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
vendor
164 changes: 164 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Red je Pakketje api client

[Red je Pakketje API documentation](https://redjepakketje.docs.apiary.io)

## Installation

Get it with composer

```
composer require jacobdekeizer/redjepakketje-client
```

## Usage

Create the client

```php
$client = new \jacobdekeizer\Client();

$client->setApiKey('api_key');
```

### Create shipment

```php
$shipment = (new \jacobdekeizer\Resources\Shipment())
->setCompanyName('Boeren BV')
->setName('Gijs Boersma')
->setStreet('Lange laan')
->setHouseNumber(29)
->setHouseNumberExtension('a')
->setZipcode('9281EM')
->setCity('Zevenaar')
->setTelephone('0602938172')
->setEmail('[email protected]')
->setReference('Bestelling 112')
->setNote('Some note')
->setName('My Company')
->setDeliveryDate(date('Y-m-d'))
->setProduct(\jacobdekeizer\Resources\Shipment::PRODUCT_SAME_DAY_PARCEL_STANDARD)
->setPickUpPoint('pick_up_point_uuid');

$shipmentResponse = $client->shipments()->create(
$shipment,
new \jacobdekeizer\Parameters\Shipments\Create() // optional
);

$label = $shipmentResponse->getLabel();
```

### List shipments

```php
$shipmentsList = $client->shipments()->all(
new \jacobdekeizer\Parameters\Shipments\All() // optional
);
```

### Get shipment

```php
$shipmentResponse = $client->shipments()->get(
'your_tracking_code',
new \jacobdekeizer\Parameters\Shipments\GetLabel() // optional
);
```

### Get label

```php
$labelContents = $client->shipments()->getLabel(
'your_tracking_code',
new \jacobdekeizer\Parameters\Shipments\GetLabel() // optional
);
```

### Create return shipments

```php
$returnShipment = (new \jacobdekeizer\Resources\ReturnShipment())
->setName('Gijs Boersma')
->setStreet('Lange laan')
->setHouseNumber(29)
->setHouseNumberExtension('a')
->setZipcode('9281EM')
->setCity('Zevenaar')
->setTelephone('0602938172')
->setEmail('[email protected]')
->setReference('Bestelling 112')
->setNote('Some note')
->setReceiverName('My company')
->setPickUpPoint('pick_up_point_uuid')
->setProduct(\jacobdekeizer\Resources\ReturnShipment::PRODUCT_SAME_DAY_PARCEL_STANDARD)
->setNote('some text');

$returnShipmentResponse = $client->returns()->create($returnShipment);
```

### List return shipments

```php
$returnShipmentsList = $client->returns()->all(
new \jacobdekeizer\Parameters\Returns\All() // optional
);
```

### Get return shipment

```php
$returnShipment = $client->returns()->get('return_shipment_uuid');
```

### List pick up points

```php
$pickUpPoints = $client->pickUps()->all();
```

### Get pick up point

```php
$pickUpPoint = $client->pickUps()->get('pick_up_point_uuid');
```

### Create contact

```php
$contact = (new \jacobdekeizer\Resources\Contact())
->setFirstName('John')
->setLastName('Doe')
->setEmail('[email protected]')
->setTelephone('+31612345678')
->setGender(\jacobdekeizer\Resources\Contact::GENDER_MALE)
->setReference('abcdefg');

$contactResponse = $client->contacts()->create($contact);
```

### List all contacts

```php
$contacts = $client->contacts()->all();
```

### Get contact

```php
$contact = $client->contacts()->get('3c8a9435-8b68-4d06-847d-4d1cd5f7c27a');
```

### Update contact

```php
$contact = (new \jacobdekeizer\Resources\Contact())
->setUuid('uuid_of_contact')
->setFirstName('Jane')
->setLastName('Doe')
->setEmail('[email protected]')
->setTelephone('+31612345678')
->setGender(\jacobdekeizer\Resources\Contact::GENDER_FEMALE)
->setReference('abcdefg');

$contactResponse = $client->contacts()->update($contact);
```
23 changes: 23 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "jacobdekeizer/statusweb-client",
"type": "library",
"description": "Red je Pakketje API client for PHP",
"keywords": ["api", "red je pakketje", "redjepakketje", "client", "php"],
"homepage": "https://github.com/jacobdekeizer/redjepakketje-client",
"license": "MIT",
"authors": [
{
"name": "Jacob de Keizer"
}
],
"require": {
"php": ">=7.2",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.4"
},
"autoload": {
"psr-4": {
"jacobdekeizer\\": "src/"
}
}
}
Loading

0 comments on commit 795d935

Please sign in to comment.