1. Go to this page and download the library: Download kabunx/elastic 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/ */
kabunx / elastic example snippets
namespace App\Entities;
use Carbon\Carbon;
use Kabunx\Elastic\Hydrate\EsEntity;
use Kabunx\Elastic\Hydrate\EsProperty;
use Kabunx\Elastic\Exceptions\EsException;
class UserEntity extends EsEntity
{
#[EsProperty("userId")]
public int $id;
public string $name;
public ?Carbon $date;
/**
* @var array|UserAddressEntity[]
*/
#[EsProperty(UserAddressEntity::class)]
public $address = [];
}
use App\Entities\UserEntity;
(new UserEntity())->getProperties()