punktde/sylius-api
composer require punktde/sylius-api
Sylius Shop Admin API Client for the Flow Framework
1.5.2
- Requires
- neos/flow: ^5.0 || ^6.0 || ^7.0
- sainsburys/guzzle-oauth2-plugin: *
- symfony/serializer: ^4.0
- symfony/property-access: ^4.1
Sylius Shop Admin API Client for the Flow Framework
This Flow package provides a programmable interface to the Sylius Shop admin API.
Implemented Endpoints
The following Endpoints are currently implemented, see the admin API documentation for details:
- Cart
- CartItem
- Checkout
- Country
- Customer
- Product
- ProductVariant
- Order
- User
- Zone
Setup
Installation
The installation is done with composer:
composer require punktde/sylius-api
Configuration
- Create a new API user in Sylius.
- Configure URL and client credentials in your settings.
Usage Examples
Find a single product by its identifier
/**
* @Flow\Inject
* @var PunktDe\Sylius\Api\Resource\ProductResource
*/
protected $products;
/**
* @param string $identifier
* @return PunktDe\Sylius\Api\Dto\Product
*/
private function findOneProductByIdentifier(string $identifier): PunktDe\Sylius\Api\Dto\Product {
$this->products->get($identifier);
}
Find an existing cart of the currrent logged in user
/**
* @Flow\Inject
* @var PunktDe\Sylius\Api\Resource\CartResource
*/
protected $cartResource;
/**
* @return Cart|null
*/
private function retrieveExistingCartByCustomerMail(): ?PunktDe\Sylius\Api\Dto\Cart
{
$cartCollection = $this->getCartResource()->getAll([
'customer' => [
'searchOption' => 'equal',
'searchPhrase' => $this->getLoggedInUserEmail()
]
]);
return current($cartCollection);
}
The same vendor provides 33 package(s).