1. Go to this page and download the library: Download vortos/vortos-search 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/ */
vortos / vortos-search example snippets
final class ApplicationSearchProjector implements SearchableProjection
{
public function subscribesTo(): array { return [ApplicationSubmitted::class, ApplicationDeleted::class]; }
public function project(object $event): SearchUpsert|SearchDelete|null
{
if ($event instanceof ApplicationDeleted) {
return new SearchDelete('application', $event->id, $event->tenantId);
}
return new SearchUpsert(new SearchDocument(
type: 'application', entityId: $event->id, tenantId: $event->tenantId,
title: $event->applicantName, subtitle: $event->status,
deeplink: "/applications/{$event->leadEntryId}",
permission: 'entries.view.any',
keywords: [$event->email],
));
}
}
use Vortos\Search\DependencyInjection\VortosSearchConfig;
use Vortos\Search\Enum\SearchDriver;
return static function (VortosSearchConfig $config): void {
$config
->driver(SearchDriver::PostgresFts) // default: Portable
->rowLevelSecurity(true) // DB-enforced org isolation
->cacheTtl('15 seconds') // hot-query cache (needs a Redis SearchCacheInterface)
->consumer('vortos.search'); // logical consumer the app's messaging config uses
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.