Download the PHP package cakephp/elastic-search without Composer

On this page you can find all versions of the php package 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 elastic-search

Elasticsearch Datasource for CakePHP

Build Status Latest Stable Version Total Downloads Code Coverage

Use Elastic Search as an alternative ORM backend in CakePHP 5.0+.

You can find the documentation for the plugin in the Cake Book.

Installing Elasticsearch via composer

You can install Elasticsearch into your project using composer. For existing applications you can add the following to your composer.json file:

"require": {
    "cakephp/elastic-search": "^4.0"
}

And run php composer.phar update

Versions Table

Cake\ElasticSearch CakePHP ElasticSearch
1.x 3.0 - 3.5 2.x - 5.x
2.x 3.6+ 6.x
>3, <3.4.0 4.0+ 6.x
>=3.4.0 4.0+ 7.x
4.x 5.0+ 7.x

You are seeing the 3.x version.

Connecting the Plugin to your Application

After installing, you should tell your application to load the plugin:

Defining a connection

Before you can do any work with Elasticsearch models, you'll need to define a connection:

As an alternative you could use a link format if you like to use enviroment variables for example.

You can enable request logging by setting the log config option to true. By default the debug Log profile will be used. You can also define an elasticsearch log profile in Cake\Log\Log to customize where Elasticsearch query logs will go. Query logging is done at a 'debug' level.

Getting a Index object

Index objects are the equivalent of ORM\Table instances in elastic search. You can use the IndexRegistry factory to get instances, much like TableRegistry:

If you have loaded the plugin with bootstrap enabled you could load indexes using the model factory in your controllers

Each Index object needs a correspondent Elasticsearch index, just like most of ORM\Table needs a database table.

In the above example, if you have defined a class as CommentsIndex and the IndexRegistry can find it, the $comments will receive a initialized object with inner configurations of connection and index. But if you don't have that class, a default one will be initialized and the index name on Elasticsearch mapped to the class.

The Index class

You must create your own Index class to define the name of internal index for Elasticsearch, as well as to define the mapping type and define any entity properties you need like virtual properties. As you have to use only one mapping type for each index, you can use the same name for both (the default behavior when type is undefined is use singular version of index name). Index types were removed in ElasticSearch 7.

Running tests

We recommend using the included docker-compose.yml for doing local development. The Dockerfile contains the development environment, and an Elasticsearch container will be downloaded and started on port 9200.

Once inside the container you can install dependencies and run tests.

Warning: Please, be very carefully when running tests as the Fixture will create and drop Elasticsearch indexes for its internal structure. Don't run tests in production or development machines where you have important data into your Elasticsearch instance.

Assuming you have PHPUnit installed system wide using one of the methods stated here, you can run the tests for CakePHP by doing the following:

  1. Copy phpunit.xml.dist to phpunit.xml
  2. Run phpunit

All versions of elastic-search with dependencies

PHP Build Version
Package Version
Requires cakephp/cakephp Version ^5.0.0
ruflin/elastica Version ^7.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 cakephp/elastic-search contains the following files

Loading the files please wait ....