avadim/manticore-query-builder-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

avadim/manticore-query-builder-php

Composer 安装命令:

composer require avadim/manticore-query-builder-php

包简介

Manticore Search Query Builder for PHP (unofficial PHP client)

README 文档

README

GitHub Release Packagist Downloads GitHub License Static Badge

Manticore Search Query Builder for PHP (unofficial PHP client)

Query Builder for Manticore Search in PHP with Laravel-like syntax

Features

  • MySQL multiple connections via PDO (because Manticore is SQL-first)
  • Placeholders as prefix in table names
  • Named parameters in expressions
  • Clear Laravel-like syntax
  • Multiple INSERT and REPLACE
  • Support MATCH() and multi-level WHERE for SELECT
  • Support faceted search

More detail documentation is available in /docs folder. Manticore Search server documentation: https://manual.manticoresearch.com/

Quick start guide

use avadim\Manticore\QueryBuilder\Builder as ManticoreDb;

// Define config
$config = [
    'defaultConnection' => 'default',
    'connections' => [
        // Default connection which will be used with environment variables
        'default' => [
            'host' => 'localhost',
            'port' => 9306,
            'username' => null,
            'password' => null,
            'timeout' => 5,
            'prefix' => 'test_', // prefix that will replace the placeholder "?<table_name>"
            'force_prefix' => false,
        ],
    ],
];

// Init query builder
ManticoreDb::init($config);

// Create table
ManticoreDb::create('?products', function (SchemaTable $table) {
    $table->timestamp('created_at');
    $table->string('manufacturer'); 
    $table->text('title'); 
    $table->json('info'); 
    $table->float('price'); 
    $table->multi('categories'); 
    $table->bool('on_sale'); 
});

// Insert single row
$singleRow = [
    'created_at' => time(),
    'manufacturer' => 'Samsung',
    'title' => 'Galaxy S23 Ultra',
    'info' => ['color' => 'Red', 'storage' => 512],
    'price' => 1199.00,
    'categories' => [5, 7, 11],
    'on_sale' => true,
];
$res = ManticoreDb::table('?products')->insert($singleRow);
// $res->result() => <id> of the new record

// Insert multiple rows
$multipleRows = [
    [
        'created_at' => time(),
        'manufacturer' => '...',
        'title' => '...',
        'info' => [],
        // ...
    ],
    [
        'created_at' => time(),
        'manufacturer' => '...',
        'title' => '...',
        'info' => [],
        // ...
    ],
];
$res = ManticoreDb::table('?products')->insert($multipleRows);
// $res->result() => array of <id> of new records

$rows = ManticoreDb::table('?products')->match('galaxy')->where('price', '>', 1100)->get();

Documentation

More detail documentation is available in /docs folder.

Want to support?

if you find this package useful just give me a star on GitHub :)

统计信息

  • 总下载量: 3.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固