https://github.com/bigcommerce/sample-shipping-provider
Silex based reference implementation of a Shipping Carrier Service integration
https://github.com/bigcommerce/sample-shipping-provider
Last synced: 4 months ago
JSON representation
Silex based reference implementation of a Shipping Carrier Service integration
- Host: GitHub
- URL: https://github.com/bigcommerce/sample-shipping-provider
- Owner: bigcommerce
- License: mit
- Created: 2019-02-18T05:56:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-06T16:37:06.000Z (over 1 year ago)
- Last Synced: 2025-04-22T15:44:59.518Z (about 1 year ago)
- Language: PHP
- Size: 131 KB
- Stars: 2
- Watchers: 11
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Symfony based reference implementation of a Shipping Carrier Service integration
This is a very simple reference application based on Symfony, that demonstrates how to process a request from the BigCommerce Carrier Service integration and return a valid response.
It is designed to quickly deploy to Heroku and let you get started on your development with minimal ramp-up.
## Requirements
Check composer.json but in general:
- PHP >=8.4
- composer
- xdebug (for development/debugging)
## Running locally
```
$ git clone ...
$ composer install
$ COMPOSER_PROCESS_TIMEOUT=0 composer run-script run
```
Then, browse to http://localhost:8888
**Note** To enable xdebug support replace `run` with `devrun` (see composer.json 'scripts' sections for details)
## Running tests
```
$ composer install
$ ./vendor/bin/phpunit
```
## Running on Heroku
[](https://heroku.com/deploy)
Or do the manual thing...
```
$ heroku login -i
$ heroku create
$ git push heroku master
$ heroku open
```
**Note** Some additional setup may be required ([Setting up Heroku + PHP](https://devcenter.heroku.com/articles/getting-started-with-php))
## Sample app contents
The default landing page contains an overview of how to trigger various shipping rate responses from the sample app.
- `config/services.yaml` wires the API controller and service used for the sample responses.
- `ShippingRateAPIController.php` the basic API controller with minimal validation and error handling to pass POST requests to an API service
- `StubbedShippingRateAPIService.php` the basic rate API service that returns a static json file based on the rate request destination country code
- `SimpleRateAPIServiceInterface.php` a simple interface that you can extend from to build to your own rate service (just change the DI wiring above to instantiate your new service instead of the stubbed one)
## Disclaimer
This is just one way to implement your service integration, there is no restriction on how you structure your application or what framework you use.
Feel free to pick what parts, if any, from this repo to use in your own development.