An open API service indexing awesome lists of open source software.

https://github.com/vasildakov/shipping

Shipping
https://github.com/vasildakov/shipping

Last synced: 5 months ago
JSON representation

Shipping

Awesome Lists containing this project

README

          

# Shipping

![build](https://github.com/vasildakov/shipping/actions/workflows/php.yml/badge.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/vasildakov/shipping/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/vasildakov/shipping/?branch=main)
[![Code Coverage](https://scrutinizer-ci.com/g/vasildakov/shipping/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/vasildakov/shipping/?branch=main)
[![Total Downloads](https://img.shields.io/packagist/dt/vasildakov/shipping.svg)](https://packagist.org/packages/vasildakov/shipping/stats)

## Features

This library is compliant with [PSR-7: HTTP message interfaces](https://www.php-fig.org/psr/psr-7/), [PSR-17: HTTP Factories](https://www.php-fig.org/psr/psr-17/) and [PSR-18: HTTP Client](https://www.php-fig.org/psr/psr-18/)

## Installation

Using Composer:

```
$ composer require vasildakov/shipping
```

## Tests

```bash
$ ./vendor/bin/phpunit

# with code coverage
$ ./vendor/bin/phpunit --coverage-html ./build/coverage
```

## Configuration

...

Add your adapters configuration to a `.env` file in the root of your project. Make sure the `.env` file is
added to your `.gitignore` so it is not checked-in the code

```dotenv
SPEEDY_USERNAME="username"
SPEEDY_PASSWORD="password"
SPEEDY_LANGUAGE="EN"

ECONT_USERNAME="username"
ECONT_PASSWORD="password"
```

## Usage

Here is a simple example of how to use Shipping. As you can see, Shipping has a consistent, well thought out API.
As much as possible, we try to abstract the differences between the various shipping gateways.
```php
getCountries();

```

```php
getCountries();

foreach ($response->countries as $country) {
dump($country);
}
```

### 2 Cities

```php
getCities($request);

foreach ($response->cities as $city) {
dump($city);
}

```

### 3 Offices

```php
getOffices($request);

foreach ($response->offices as $office) {
dump($office);
}

```

## License

Code released under [the MIT license](https://github.com/vasildakov/shipping/blob/main/LICENSE)