1. Go to this page and download the library: Download fadion/bouncy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fadion / bouncy example snippets
use Fadion\Bouncy\BouncyTrait;
class Product extends Eloquent {
use BouncyTrait;
// ...other Eloquent attributes
// or methods.
}
$products = Product::search($params);
$products->total(); // Total number of hits
$products->maxScore(); // Maximum score of the results
$products->took(); // Time in ms it took to run the query
$products->timedOut(); // Wheather the query timed out, or not.
$products->shards(); // Array of shards information
$products->shards($key); // Information on specific shard
$products = Product::search($params);
foreach ($products as $product) {
$product->isDocument(); // Checks if it's an Elasticsearch document
$product->documentScore(); // Score set in search results
$product->documentVersion(); // Document version if present
}
use Fadion\Bouncy\BouncyTrait;
class Product extends Eloquent {
use BouncyTrait;
public function documentFields()
{
return [
'id' => $this->id,
'price' => $this->price,
'rating' => 'perfect'
];
};
}
use Illuminate\Database\Eloquent\Collection;
use Fadion\Bouncy\BouncyCollectionTrait;
class MyAwesomeCollection extends Collection {
use BouncyCollectionTrait;
}
Elastic::index();
Elastic::get();
Elastic::search();
Elastic::indices()->create();
// and any other method it provides
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.