https://github.com/vasildakov/shipping
Shipping
https://github.com/vasildakov/shipping
Last synced: 5 months ago
JSON representation
Shipping
- Host: GitHub
- URL: https://github.com/vasildakov/shipping
- Owner: vasildakov
- License: mit
- Created: 2023-12-28T16:34:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T19:15:36.000Z (over 2 years ago)
- Last Synced: 2024-04-10T22:05:02.853Z (about 2 years ago)
- Language: PHP
- Size: 214 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Shipping

[](https://scrutinizer-ci.com/g/vasildakov/shipping/?branch=main)
[](https://scrutinizer-ci.com/g/vasildakov/shipping/?branch=main)
[](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)