Download the PHP package 3xw/cakephp-elastic-search without Composer

On this page you can find all versions of the php package 3xw/cakephp-elastic-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-elastic-search

cakephp-elastic-search plugin for CakePHP

This plugin allows you deal with ES

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require 3xw/elastic-search

Load it in your config/boostrap.php

Plugin::load('Trois/ElasticSearch');

Setup

in app.php add at least one connection:

'Datasources' => [
    'elastic' => [
      'className' => 'Cake\ElasticSearch\Datasource\Connection',
      'driver' => 'Cake\ElasticSearch\Datasource\Connection',
      'host' => 'localhost',
      'port' => 6379,
    ],
    ...
]

Mapping

The shell will ask you a mapping template. Follow offical doc native elasticsearch mapping format to create your own index mapping or use default one which the prompt proposes you: vendor/3xw/cakephp-elastic-search/templates/mapping.json

{
    "settings": {
    "analysis": {
      "filter": {
        "french_elision": {
          "type":"elision",
          "articles_case": true,
          "articles": [
            "l", "m", "t", "qu", "n", "s",
            "j", "d", "c", "jusqu", "quoiqu",
            "lorsqu", "puisqu","t"
          ]
        },
        "french_stop": {
          "type":       "stop",
          "stopwords":  "_french_"
        },
        "french_keywords": {
          "type":       "keyword_marker",
          "keywords":   [
            "Prométerre",
            "Agrivit","Ecoprest","Estimapro","Fidasol","Fiprom",
            "Fondation rurale de prévoyance","FRP",
            "Mandaterre",
            "Office de crédit agricole","OCA",
            "Proconseil","Proterroir","SAD","SRPJ","Sofia SA"
          ]
        },
        "french_stemmer": {
          "type":       "stemmer",
          "language":   "light_french"
        }
      },
      "analyzer": {
        "french": {
          "tokenizer":  "standard",
          "filter": [
            "french_elision",
            "lowercase",
            "french_stop",
            "french_keywords",
            "french_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "items": {
      "properties": {
        "foreign_key": { "type": "integer"},
        "model": { "type": "keyword"},
        "title": {"type": "completion", "analyzer":"french", "max_input_length": 255},
        "content": {"type": "text"}
      }
    }
  }
}

Behavior

set up your behavior as you wish

$this->addBehavior(\Trois\ElasticSearch\ORM\Behavior\SyncWithESBehavior::class,[
  'index' => 'App\Model\Index\ItemsIndex',
  'primaryKey' => 'foreign_key', // string or callable
  'translate' => false, // property name if yes ex: locale
  'staticMatching' => [
    'model' => 'Posts'
  ], // or [keyN => valueN/callableN]
  'mapping' => [ // properties => 1. Array: entity field(s) || properties => 2. String: static value or callable
    'title' => new \Trois\ElasticSearch\ORM\CompletionConstructor(['title'],[
      'contexts' => [
        'model' => 'Posts'
      ],
     ]),
    'content' => ['header','content']
  ],
  'deleteDocument' => true,
  'separator' => ' - '
]);

Shell

Create indexes

bin/cake elastic create [indexName] [mappingFile.json]

------
Execute create index w/ mapping file Task.

Usage:
cake trois/elastic_search.elastic create [-c] [-h] [-q] [-r 1] [-s 5] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--replicas, -r    The index number of replicas. Default is 1
                  (default: 1)
--shards, -s      The index number of shards. Default is 5
                  (default: 5)
--verbose, -v     Enable verbose output.

Get index info

bin/cake elastic info [indexName]

------
Execute info on index Task.

Usage:
cake trois/elastic_search.elastic info [-c] [-h] [-q] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--verbose, -v     Enable verbose output.

Delete index

bin/cake elastic delete [indexName]

------
Execute delete index Task.

Usage:
cake trois/elastic_search.elastic delete [-c] [-h] [-q] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--verbose, -v     Enable verbose output.

Import entire table

bin/cake elastic import [indexName] [tableName]
------
Execute import on index with table.

Usage:
cake trois/elastic_search.elastic import [-c] [-h] [-q] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--verbose, -v     Enable verbose output.

All versions of cakephp-elastic-search with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
cakephp/cakephp Version ^4.0
cakephp/elastic-search Version 3.2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 3xw/cakephp-elastic-search contains the following files

Loading the files please wait ....