Download the PHP package answear/luigis-box-bundle without Composer
On this page you can find all versions of the php package answear/luigis-box-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download answear/luigis-box-bundle
More information about answear/luigis-box-bundle
Files in answear/luigis-box-bundle
Package luigis-box-bundle
Short Description Luigi's Box integration for Symfony.
License MIT
Informations about the package luigis-box-bundle
Luigi's Box Bundle
Luigi's Box integration for Symfony. Luigi's Box documentation can be found here: https://live.luigisbox.com/.
Installation
- install with Composer
Setup
- provide required config data:
publicKeyandprivateKey searchCacheTtlis time to live for Luigi cache request in seconds (max 300 seconds - this is Luigi's Box limit)
If you have only one config you can omit default_config node.
Configs will be passed to \Answear\LuigisBoxBundle\Service\ConfigProvider class.
If you have more configurations you can change them as follows
and use application as before.
If you need to pass custom headers to search request do it as follows
Dynamic configurations
You can pass additional configuration.
Usage
Content requests
- Full content update document
First argument ($title) will be used as product's title in Luigi's Box unless a title field is present in the $fields argument.
- Change availability
Additional method to simply enable/disable objects - partial update will be used.
In all request you can catch some exceptions:
BadRequestException- bad request,TooManyItemsException- make request with fewer items,MalformedResponseException- something went wrong with Luigi's Box api response,TooManyRequestsException- delay request rate,ServiceUnavailableException
Consider catching them separately:
Content response
\Answear\LuigisBoxBundle\Response\ApiResponse:
- (bool)
$success-trueif all documents will be passed successfully, - (int)
$okCount- number of successfully passed documents, - (int)
$errorsCount- number of failed documents, - (array)
$errors- array of\Answear\LuigisBoxBundle\Response\ApiResponseErrorobjects, - (array)
$rawResponse- decoded response from api.
ApiResponseError:
- (string)
$url- url of document - (string)
$type- type of error (ex.malformed_input) - (string)
$reason- failure text (ex.incorrect object format) - (array|null)
$causedBy- specific reason of error (ex.["url": ["is missing"]])
Note!
ApiResponse::$success will be set to false if any of passed documents fails. Check $okCount if you want to know how many documents were updated and $errors to check exactly which documents failed.
Searching (documentation here)
- Request
Check the Luigi's Box documentation to find out exact purpose of each field SearchUrlBuilder is exposing.
- Response
SearchRequest::search() will return a SearchResponse object with following fields:
- (string) $searchUrl
- (string) $query
- (string|null) $correctedQuery
- (array) $filters
- (Hit[]) $hits.
Hit:- (string) $url;
- (array) $attributes;
- (array) $nested;
- (string) $type;
- (array) $highlight;
- (bool) $exact;
- (bool) $alternative;
- (Hit[]) $quickSearchHits
- like above
- (Facet[]) $facets.
Facet:- (string) $name;
- (string) $type;
- (array) $values;
- (int) $totalHits
- (int) $currentSize
Update by query (documentation here)
-
Update
- Retrieve job status
getStatus will return UpdateByQueryStatusResponse with following fields:
- (array) $rawResponse
- (string) $trackerId
- (bool) $completed
- (int|null) $okCount - null if not completed
- (int|null) $errorsCount - null if not completed
- (ApiResponseError[]|null) $errors - null if not completed
Final notes
Feel free to make pull requests with new features, improvements or bug fixes. The Answear team will be grateful for any comments.
Have fun!
All versions of luigis-box-bundle with dependencies
ext-json Version *
webmozart/assert Version ^1.11
symfony/validator Version ^7.0|^8.0
symfony/http-kernel Version ^7.0|^8.0
guzzlehttp/guzzle Version ^7.8.2
guzzlehttp/psr7 Version ^2.6
symfony/serializer Version ^7.0.3|^8.0
symfony/property-access Version ^7.0|^8.0
symfony/dependency-injection Version ^7.0.3|^8.0
symfony/config Version ^7.0.3|^8.0
symfony/yaml Version ^7.0.3|^8.0