Download the PHP package szunisoft/laravel-unas without Composer
On this page you can find all versions of the php package szunisoft/laravel-unas. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-unas
Laravel Unas
About the package
The package is not finished yet however will be maintained and developed continuously as our primary project which requires this extension will.
Naming conventions
At some point the official Unas naming convention is not that good or does not exist at all. However the package is not trying to introduce custom naming conventions it will use the official property and attribute names as they are described in the documentation.
API compatibility
The following table contains the related API endpoints. All the endpoints will be supported soon.
Endpoint | Support |
---|---|
getProduct | :heavy_check_mark: |
setProduct | :x: |
getOrder | :x: |
setOrder | :x: |
getStock | :x: |
setStock | :x: |
getCategory | :x: |
setCategory | :x: |
getNewsletter | :x: |
setNewsletter | :x: |
Future features :star:
Configurable Rate Limiting
Will fire an event each time an endpoint is being exhausted based on the given configuration.
Requirements :exclamation:
- php >= 7.2
- ext-xmlwriter
- ext-simplexml
Install :arrow_forward:
Laravel support :hand:
>= 5.5
Configure :gear:
Export the configuration
Authentication
Two authentication drivers are supported.
Legacy (default driver)
You must set the driver to legacy.
For legacy authentication you will need the following credentials:
- username
- password
- shop_id
- auth_code
Key
You must set the driver to key.
In case of key authentication you will need to generate an API key inside the Unas portal.
Error handling principles
Some kind of exceptions can be turned into events rather than throwing them. This is just a code architectural decision how a particular circumstance should be handled.
For instance we create a multi-tenancy project which will handle tons of different clients traffic behind the scenes. It is more wise to consume and intercept errors as events since we'll be able to use multiple listeners on it and we can send notification to the tenant also.
In the other hand if you'll need a very specific and custom application for a single tenant then it would be more appropriate to intercept errors as exceptions because it is probably the core component of the entire application.
By default all events are disabled and going to raise.
To adjust your needs your can freely add or remove events declared in the configuration file.
The following errors can be turned into events.
Exception | Event |
---|---|
EndpointBlacklistedException | EndpointBlacklisted |
InvalidConfigurationException | InvalidConfiguration |
AuthenticationException | Unauthenticated |
PremiumAuthenticationException | Unauthenticated |
A little talk about each exception
EndpointBlacklistedException
Thrown when an endpoint is being exhausted for a single client. You can access the client and the until Carbon instance.
InvalidConfigurationException
Thrown in case of bad client configuration.
AuthenticationException
This exception will be thrown when legacy or key credentials are invalid. You can access the field which was invalid.
PremiumAuthenticationException
Thrown when the desired authentication way is API key but related tenant has no Premium package. In this case tenant should use the legacy approach.
TooHighChunkException
Thrown when an endpoint does not allow the amount of given results per page.
Remembering clients
Sometimes you wish to have multiple clients. If you want clients to be remembered you can turn on this feature in the configuration. Remembering client will avoid creating multiple clients for the same authentication credentials.
Creating and accessing client
There are multiple ways to create clients.
Dependency Injection
This method will use the credentials given in the configuration.
IoC Container
This method will use the credentials given in the configuration.
Sometimes you want to customize the client by yourself. For these kind of desires you can use the client Builder and client Factory.
Client Builder
Client Factory
Get Products
Accessing page #1 with 50 products per page.
All versions of laravel-unas with dependencies
laravel/framework Version ~5.5
guzzlehttp/guzzle Version ^6.3.3
ext-xmlwriter Version *
ext-simplexml Version *
orchestra/parser Version ^3.8