PHP code example of x-laravel / embedding-mysql-driver
1. Go to this page and download the library: Download x-laravel/embedding-mysql-driver 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/ */
x-laravel / embedding-mysql-driver example snippets
use XLaravel\Embedding\Attributes\EmbedOn;
use XLaravel\Embedding\Concerns\Embeddable;
use XLaravel\Embedding\Contracts\HasEmbeddings;
#[EmbedOn(['title', 'body'])]
class Post extends Model implements HasEmbeddings
{
use Embeddable;
public function toEmbeddingText(): string
{
return $this->title.' '.$this->body;
}
}