2017 © Pedro Peláez
 

library royal-mail-price-calculator

A library to calculate the cost of sending a package with Royal Mail.

image

alexedimensionz/royal-mail-price-calculator

A library to calculate the cost of sending a package with Royal Mail.

  • Monday, November 20, 2017
  • by Alex_Edimensionz
  • Repository
  • 0 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Royal Mail Price Calculator

This library is forked to revive it. Built by WyldCode a subsidiary of e-dimensionz, Inc, (*1)

It allows you to calculate the cost of sending a package with Royal Mail, updated prices and extends support to all package prices., (*2)

Usage

Install the latest version with composer require alexedimensionz/royal-mail-price-calculator, (*3)

Main Changes from Justin Hook's Repo

  • Removed Doctrine requirement
  • Added all shipping types
  • Added International shipping options and prices
  • Continuously Updating price lists

Supported Services, (*4)

Service Class
1st Class Service FirstClassService()
2nd Class Service SecondClassService()
Signed For 1st Class SignedForFirstClassService()
Signed For 2nd Class SignedForSecondClassService()
Guaranteed by 9am GuaranteedByNineAmService()
Guaranteed by 9am with Saturday Guarantee GuaranteedByNineAmWithSaturdayService()
Guaranteed by 1pm GuaranteedByOnePmService()
Guaranteed by 1pm with Saturday Guarantee GuaranteedByOnePmWithSaturdayService()
International Economy InternationalEconomy()
International Standard InternationalStandard()
International Signed InternationalSigned()
International Tracked InternationalTracked()
International Tracked And Signed InternationalTrackedAndSigned()

Example for UK Delivery Targets

setDimensions(15, 15, 0.4);
$package->setWeight(90);

$calculator->setServices(array(
                            new FirstClassService(), 
                            new GuaranteedByOnePmService()));

foreach ($calculator->calculatePrice($package) as $calculated)
{
    echo $calculated['service']->getName() . "\n";
    foreach ($calculated['prices'] as $price) {
        echo "  →  £{$price['price']} (Compensation: £{$price['compensation']})\n";
    }
    echo "\n";
}
```

Will output something like:
```
1st Class Service
  →  £0.62 (Compensation: £20)

Guaranteed by 1pm
  →  £6.40 (Compensation: £500)
  →  £7.40 (Compensation: £1000)
  →  £9.40 (Compensation: £2500)
```

Example for International Delivery Targets
------------------------------------------
```php
setDimensions(15, 15, 0.4);
$package->setWeight(90);

// This part is mandatory for international shipments
$target_iso = 'US';
$calculator->setCountryCode($target_iso);
//


$calculator->setServices(array(
                            new InternationalTracked(), 
                            new InternationalEconomy()));


// Note: there is no compensation value for international
foreach ($calculator->calculatePrice($package) as $calculated)
{
    echo $calculated['service']->getName() . "\n";
    foreach ($calculated['prices'] as $price) {
        echo "  →  £{$price['price']}\n";
    }
    echo "\n";
}
```

Will output something like:
```
International Tracked
  →  £8.50

International Economy
  →  £13.30
```


Useful Functions
----------------

Royal Mail has 5 delivery zones:
- UK
- Europe
- International (Zone 1)
- International (Zone 2)
- US (Zone 3)

You can find the zone code for your country by using the 2-Letter ISO code.

```php

CA region is: <br/>
US region is: <br/>
GB region is: <br/>
AU region is: <br/>
DE region is: 

Will output:, (*5)

CA region is: intl_1
US region is: intl_3
GB region is: uk
AU region is: intl_2 
DE region is: eu

The Versions

20/11 2017

dev-master

9999999-dev https://github.com/alexedimensionz/royal-mail-price-calculator

A library to calculate the cost of sending a package with Royal Mail.

  Sources   Download

MIT

The Requires

 

by Alex @ Wyldcode | e-dimensionz, Inc

calculator royal mail postage

12/11 2017

1.1.1

1.1.1.0 https://github.com/alexedimensionz/royal-mail-price-calculator

A library to calculate the cost of sending a package with Royal Mail.

  Sources   Download

MIT

The Requires

 

by Alex @ Wyldcode | e-dimensionz, Inc

calculator royal mail postage

12/11 2017

1.1

1.1.0.0 https://github.com/alexedimensionz/royal-mail-price-calculator

A library to calculate the cost of sending a package with Royal Mail.

  Sources   Download

MIT

The Requires

 

by Alex @ Wyldcode | e-dimensionz, Inc

calculator royal mail postage

21/05 2015

1.0

1.0.0.0 https://github.com/JustinHook/royal-mail-price-calculator

A library to calculate the cost of sending a package with Royal Mail.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Justin Hook

calculator royal mail postage