quicktech-as / cargonizer
Package Laravel for Logistra Cargonizer API
1.0.6
2017-11-06 22:19 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ^5.2
- openlss/lib-array2xml: ^0.5.1
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-12-22 03:56:00 UTC
README
Quicktech\Cargonizer is a succinct and flexible way to use Cargonizer services in Laravel 5 applications.
Contents
Installation
- In order to install Laravel 5, just add the following to your composer.json. Then run
composer update
:
"quicktech/cargonizer": "^1.0"
- Open your
config/app.php
and add the following to theproviders
array:
Quicktech\Cargonizer\CargonizerServiceProvider::class,
- In the same
config/app.php
and add the following to thealiases
array:
'Cargonizer' => Quicktech\Cargonizer\Facades\Cargonizer::class,
- Run the command below to publish the package config file
config/cargonizer.php
:
php artisan vendor:publish
- Open your
.env
file setup your Cargonizer credentials:
CARGONIZER_ENDPOINT = 'http://sandbox.cargonizer.no' CARGONIZER_SENDER = 'your send id' CARGONIZER_SECRET_KEY = 'your secret key'
Configuration
Set the other properties necessaries in the config/cargonizer.php
.
These values will be used by Cargonizer to get other resouces.
Usage
Shipping Cost Estimation
To estimate the cost of shipping, you can use this resource:
$params = [ 'consignment' => [ '@attributes' => [ 'transport_agreement' => '1' ], 'product' => 'tg_dpd_innland', 'parts' => [ 'consignee' => [ 'country' => 'NO', 'postcode' => '1337' ] ], 'itens' => [ 'item' => [ '@attributes' => [ 'type' => 'package', 'amount' => '1', 'weight' => '12' ] ] ] ] ]; $consignmentCosts = Cargonizer::consignmentCosts($params);
The method above will return the following response:
[ 'estimated_cost' => 495, 'gross_mount' => 495, 'net_amount' => 495 ]
You can see more option to consignment parameters here.
License
Quicktech\Cargonizer is free software distributed under the terms of the MIT license.
Contribution guidelines
Please report any issue you find in the issues page.
Pull requests are welcome.