1. Go to this page and download the library: Download lvinkim/elasticsearch-odm 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/ */
lvinkim / elasticsearch-odm example snippets
use Lvinkim\ElasticSearchODM\Annotations as ODM;
/**
* Class User
* @ODM\Entity()
*/
class User
{
/**
* @var string
* @ODM\Id
*/
private $id;
/**
* @var int
* @ODM\Field(property="integer")
*/
private $age;
/**
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* @param string $id
*/
public function setId(string $id): void
{
$this->id = $id;
}
/**
* @return int
*/
public function getAge(): int
{
return $this->age;
}
/**
* @param int $age
*/
public function setAge(int $age): void
{
$this->age = $age;
}
}