PHPackages                             meanbee/royalmail-php-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. meanbee/royalmail-php-library

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

meanbee/royalmail-php-library
=============================

PHP library for Royal Mail shipping shipping methods

2.1.0(9y ago)32.7k1OSL-3.0PHP

Since Jan 7Pushed 9y ago2 watchersCompare

[ Source](https://github.com/meanbee/royalmail-php-library)[ Packagist](https://packagist.org/packages/meanbee/royalmail-php-library)[ Docs](https://github.com/meanbee/royalmail-php-library)[ RSS](/packages/meanbee-royalmail-php-library/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (5)Versions (18)Used By (0)

Royal Mail PHP Shipping Method Library
======================================

[](#royal-mail-php-shipping-method-library)

[![image](https://camo.githubusercontent.com/cc5c90b90e772d44553a8d845a9d569d14ff2174f7a1011a9f7d8fecb3e78478/687474703a2f2f75702e6e69636b736179732e636f2e756b2f3230306b316a33353431316f32693059304e33532f526f79616c4d61696c2e706e67)](https://camo.githubusercontent.com/cc5c90b90e772d44553a8d845a9d569d14ff2174f7a1011a9f7d8fecb3e78478/687474703a2f2f75702e6e69636b736179732e636f2e756b2f3230306b316a33353431316f32693059304e33532f526f79616c4d61696c2e706e67)

This repository contains the source code for the Meanbee Royal Mail PHP Library. It takes the country code, package value, and package weight and then outputs an array of objects containing the available shipping methods.

Using the Library
-----------------

[](#using-the-library)

To use the library, call the **getMethods** method with your country code ([in the ISO 3166 format](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)), package value, and package weight.

#### Example Usage

[](#example-usage)

```
$calculateMethodClass = new CalculateMethodClass();

$calculateMethodClass->getMethods('GB', 20, 0.050);
```

This will return an array of objects where each object contains the shipping method name, minimum weight, maximum weight, price of the method, maximum insurance value, and proper name of the shipping method.

Unit Testing
------------

[](#unit-testing)

This program is automatically unit tested with phpunit and travis.

CSV data format
---------------

[](#csv-data-format)

This library uses six CSV files to determine which shipping methods are available:

1. [1\_countryCodeToZone.csv](https://github.com/meanbee/royalmail/blob/develop/lib/Meanbee/RoyalmailPHPLibrary/data/1_countryToZone.csv)

    - Country code
    - World zone. Each country, defined by its country code can be in more then one zone. The code "GB" for Great Britain is in the EU and the GB World zone. There are four world zones:
        - WORLD\_ZONE\_GB
        - WORLD\_ZONE\_EU
        - WORLD\_ZONE\_ONE
        - WORLD\_ZONE\_TWO
2. [2\_zoneToDeliveryMethod.csv](https://github.com/meanbee/royalmail/blob/develop/lib/Meanbee/RoyalmailPHPLibrary/data/2_zoneToDeliveryMethod.csv)

    - World zone
    - Shipping zone.

    Each shipping method's name starts with the world zone it links to as prices differ between zones.
3. [3\_deliveryMethodMeta.csv](https://github.com/meanbee/royalmail/blob/develop/lib/Meanbee/RoyalmailPHPLibrary/data/3_deliveryMethodMeta.csv)

    - Delivery method
    - Minimum price of method
    - Maximum price available to the method (the maximum price of shipping cart this method applies to)
    - Max insurance available on method
    - Human-friendly method name
    - Delivery group
4. [4\_deliveryToPrice.csv](https://github.com/meanbee/royalmail/blob/develop/lib/Meanbee/RoyalmailPHPLibrary/data/4_deliveryToPrice.csv)

    - Method name
    - Minimum weight
    - Maximum weight
    - Price of method
    - Max insurance value
    - In the case of small or medium parcel up to 2kg in weight "SMALL" or "MEDIUM" else blank

Method names are constructed in the WORLDZONE\_NAME\_WITH\_UNDERSCORES format with a separate method being added for each separate foramt. Examples of these can be seen in multiple of the csvs. In the case of extra insurance available on the item, another method must be created. An example can be seen in the 3\_deliveryMethodMeta.csv.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 72% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~44 days

Total

6

Last Release

3648d ago

Major Versions

1.0.1 → v2.0.02016-06-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/07666e20eb30bff741aaa38f1b450f4475f76fb019f6b52653f514b8b1ede18e?d=identicon)[meanbee](/maintainers/meanbee)

---

Top Contributors

[![bobbyshaw](https://avatars.githubusercontent.com/u/553566?v=4)](https://github.com/bobbyshaw "bobbyshaw (36 commits)")[![RidRack](https://avatars.githubusercontent.com/u/9075838?v=4)](https://github.com/RidRack "RidRack (12 commits)")[![punkstar](https://avatars.githubusercontent.com/u/179072?v=4)](https://github.com/punkstar "punkstar (2 commits)")

---

Tags

php-libraryroyal-mail-shippingPHP Libraryshipping methodroyalmailmeanbee

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/meanbee-royalmail-php-library/health.svg)

```
[![Health](https://phpackages.com/badges/meanbee-royalmail-php-library/health.svg)](https://phpackages.com/packages/meanbee-royalmail-php-library)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[takielias/codeigniter-websocket

CodeIgniter Websocket using Ratchet Websocket technology. Inspired by https://github.com/romainrg/ratchet\_client

609.3k](/packages/takielias-codeigniter-websocket)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
