1. Go to this page and download the library: Download nebkam/odm-search-param 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/ */
nebkam / odm-search-param example snippets
class SearchFilter
{
#[SearchParam(type: SearchParamType::String)]
public string $name;
}
$builder->field('name')->equals($propertyValue);
class SearchFilter
{
#[SearchParam(type: SearchParamType::Exists, field: 'images')]
public bool $hasImages;
}
$builder->field('images')->exists(true);
class SearchFilter
{
#[SearchParam(type: SearchParamType::Int)]
public $age;
}
class SearchFilter
{
#[SearchParam(type: SearchParamType::Callable, callable: [SomeClass::class, 'setStatus'])]
public string $status;
}
class SomeClass
{
public static function setStatus(Builder|MatchStage $builder, $value, $filter)
{
// Call $builder methods to build the query
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.