Download the PHP package schababerle-digital/shopware6-api-client without Composer
On this page you can find all versions of the php package schababerle-digital/shopware6-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download schababerle-digital/shopware6-api-client
More information about schababerle-digital/shopware6-api-client
Files in schababerle-digital/shopware6-api-client
Package shopware6-api-client
Short Description Ein PHP-Client für die Shopware 6 Admin API
License MIT
Informations about the package shopware6-api-client
Shopware 6 API Client
A robust PHP client for the Shopware 6 Admin API with automatic authentication and token management.
Features
- Simple authentication via client credentials
- Automatic token management with auto-refresh
- Support for all HTTP methods (GET, POST, PATCH, DELETE)
- Helper methods for common API operations
- Comprehensive error handling
- Fully tested with PHPUnit
Installation
Quick Start
Available Methods
Main Methods
authenticate(): Performs authenticationrefreshAccessToken(): Manually refreshes the tokenrequest(string $method, string $endpoint, array $data = [], array $query = [], array $headers = []): Performs an API requestget(string $endpoint, array $query = []): Performs a GET requestpost(string $endpoint, array $data = []): Performs a POST requestpatch(string $endpoint, array $data = []): Performs a PATCH requestdelete(string $endpoint): Performs a DELETE request
Helper Methods
getProducts(array $criteria = []): Fetches productsgetOrder(string $orderId): Fetches an ordergetOrders(array $criteria = []): Fetches ordersgetCustomers(array $criteria = []): Fetches customerscreateProduct(array $productData): Creates a productupdateProduct(string $productId, array $productData): Updates a productdeleteProduct(string $productId): Deletes a product
Examples for Filter Criteria
Error Handling
The client throws exceptions when an error occurs. It is recommended to wrap your API requests in try-catch blocks:
Automatic Token Refresh
The client automatically handles token management:
- On first use,
authenticate()is automatically called if no token is present - If a token expires (or will expire in less than 30 seconds), it is automatically refreshed
- If a 401 Unauthorized error occurs, the client attempts to refresh the token and retry the request
Tests
The package contains comprehensive tests:
Setting Up Integration Tests
For integration tests, copy the .env.example file to .env and fill in your Shopware API credentials.
License
MIT
Contributing
Contributions are welcome! Please ensure all tests pass before submitting a pull request.