lsv / food-market-integration-wrapper
Wrapper for sinqro food market integration
v1.0.1
2021-12-01 14:43 UTC
Requires
- php: >=8.0
- nyholm/psr7: ^1.4
- psr/http-client: ^1.0
- symfony/options-resolver: ^5.4 | ^6.0
- symfony/property-access: ^5.4 | ^6.0
- symfony/serializer: ^5.4 | ^6.0
Requires (Dev)
- php-http/mock-client: ^1.5
- phpunit/phpunit: ^9.5
- symfony/http-client: ^6.0
Suggests
- symfony/http-client: PSR18 HTTP client
This package is auto-updated.
Last update: 2024-10-29 06:25:15 UTC
README
PHP wrapper for sinqro food market integration
Install and basic usage
Install with composer, requires PHP >8.0
composer require lsv/food-market-integration-wrapper # Add a PSR 18 client, fx composer require symfony/http-client # If you add another PSR18 client, then look below on how to use other PSR 18 clients
Authenticate usage
use Lsv\FoodMarketIntegration\Authenticate; use Lsv\FoodMarketIntegration\Request; $userAccessToken = 'your user access token'; $serverAccessToken = 'your server access token'; $authenticate = new Authenticate($userAccessToken, $serverAccessToken); Request\AbstractRequest::setAuthentication($authenticate); // Your requests
And basic usage, to fetch an order
use Lsv\FoodMarketIntegration\Request; $marketCodeIdentifier = 'your market code identifier'; $marketOrderIdentifier = 'order id'; $request = new Request\GetOrder($marketCodeIdentifier, $marketOrderIdentifier); $response = $request->request(); # Response is now an object of Response\Order
For more usages, see below.
Usage
Authenticate
Order requests
Selling point requests
Use another PSR18 HTTP Client
If you dont want to use symfony/http-client implementation, you can easily change it to another one.
You can use a http client from this list - These are all PSR18 http client implementations.
use Lsv\FoodMarketIntegration\Request; $client = $YourPSR18Client; Request\AbstractRequest::setHttpClient($client); // Your requests
TODO
- Easier to make the websocket integration