https://github.com/punktde/sylius-api
Sylius Admin API Client for the Flow Framework
https://github.com/punktde/sylius-api
flowframework hacktoberfest neoscms shop sylius
Last synced: 4 days ago
JSON representation
Sylius Admin API Client for the Flow Framework
- Host: GitHub
- URL: https://github.com/punktde/sylius-api
- Owner: punktDe
- Created: 2019-03-29T07:40:39.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T08:46:42.000Z (about 3 years ago)
- Last Synced: 2025-06-24T19:09:47.944Z (9 months ago)
- Topics: flowframework, hacktoberfest, neoscms, shop, sylius
- Language: PHP
- Homepage:
- Size: 62.5 KB
- Stars: 2
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sylius Shop Admin API Client for the Flow Framework
[](https://packagist.org/packages/punktde/sylius-api) [](https://packagist.org/packages/punktde/sylius-api)
This [Flow](https://flow.neos.io) package provides a programmable interface to the admin part of the [Sylius Shop](https://sylius.com/) unified [API](https://master.demo.sylius.com/api/v2/docs).
Version compatibility:
|PunktDe.Sylius.Api| Sylius API |
|------------------|---------------------------|
| 1.x | Admin API of Sylius < 1.9 |
| 2.x | API Platform unified API |
## Implemented Endpoints
The following Endpoints are currently implemented, see the [admin API documentation](https://master.demo.sylius.com/api/v2/docs) 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
```php
/**
* @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 current logged in user
```php
/**
* @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);
}
```