Download the PHP package valantic/pimcore-elastica-bridge without Composer

On this page you can find all versions of the php package valantic/pimcore-elastica-bridge. 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 pimcore-elastica-bridge

Elastica Bridge for Pimcore

Latest Version on Packagist PHP Checks

This package is developed by valantic CEC Schweiz and is under active development.

The only job of the bundle is to store Pimcore elements (assets, documents, data objects) into Elasticsearch documents.

Setup

  1. composer require valantic/pimcore-elastica-bridge
  2. Edit config/bundles.php and add \Valantic\ElasticaBridgeBundle\ValanticElasticaBridgeBundle::class => ['all' => true],
  3. Configure the connection to your Elasticsearch cluster as seen in example/app/config/config.yaml
  4. Don't forget to register your newly created services (implementing IndexInterface etc.) in your services.yaml

  5. Verify the setup by running bin/console valantic:elastica-bridge:status

Usage

Please see the docs/example/ folder for a complete example. The following steps link to the corresponding section in the example and explain in a bit more detail what they are doing.

Define an index

The IndexInterface describes an index in Elasticsearch, and contains methods that are required to create such an index. The easiest way to start is to extend the AbstractIndex class, which has most of the methods already implemented in a generic manner. In this case only two methods need to be implemented for a new index:

See the ProductIndex provided in the example for a more detailed implementation containing additional queries and a tenant-aware functionality.

Define a document

A document describes a Pimcore element inside an index, i.e. it represents an asset, document or data object managed in Pimcore inside the Elasticsearch index. A developer must tell this bundle about these elements by providing a class implementing the DocumentInterface . Most methods are already implemented in the AbstractDocument, so it is recommended to use that one as a base class. The four methods that need to be implemented are:

See the ProductIndexDocument provided in the example for more details.

Configuration

Events

This project uses Symfony's event dispatcher. Here are the events that you can listen to:

Description Example Usage Event Constant (ElasticaBridgeEvents::) Event Object (Model\Event\)
After an element has been refreshed in an index. Log Event, send notification POST_REFRESH_ELEMENT_IN_INDEX RefreshedElementInIndexEvent
Before an element is refreshed in an index. Stop propagation of element in specific index PRE_REFRESH_ELEMENT_IN_INDEX RefreshedElementInIndexEvent
After an element has been refreshed in all indices. Clear caches, refresh related Objects, Log Event, send notification POST_REFRESH_ELEMENT RefreshedElementEvent
Before an element is refreshed in all indices. Stop propagation of element in all indices PRE_REFRESH_ELEMENT RefreshedElementEvent

You can create an event subscriber or an event listener to listen to these events. Please refer to the Symfony documentation for more information on how to use the event dispatcher.

Possible Use Cases for Events

Event Propagation

When refreshing multiple elements, each refresh triggers an event that could potentially lead to another refresh, resulting in an endless loop. To prevent this, you can disable event propagation during the refresh process. You can disable event propagation by setting $stopPropagateEvents to true in the RefreshElement Message constructor or by calling stopEventPropagation() on the message before you add it to the queue.

Queue

Set up a worker to process elastica_bridge_index. Alternatively you can route the transport to use the sync handler: framework.messenger.transports.elastica_bridge_index: 'sync'.

Indexing

Bulk

Specific

The bridge automatically listens to Pimcore events and updates documents as needed. If needed, call \Valantic\ElasticaBridgeBundle\Service\PropagateChanges::handle or execute console valantic:elastica-bridge:refresh.

This can be globally disabled by calling \Valantic\ElasticaBridgeBundle\EventListener\Pimcore\ChangeListener::disableListener();.

You can also dispatch a Valantic\ElasticaBridgeBundle\Messenger\Message\RefreshElement message to handle updates to related objects which are not triggered by the ChangeListener.

Status

License

In order to comply with Pimcore's updated licensing policy, this bundle is (now) published under the GPLv3 license for compatibility Pimcore Platform Version 2024.4 and will be re-licensed under the POCL license as soon as it is compatible with Pimcore Platform Version 2025.1.

If you have any questiosn regarding licensing, please reach out to us at [email protected].


All versions of pimcore-elastica-bridge with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
pimcore/pimcore Version ^11.0
psr/log Version ^3.0
ruflin/elastica Version ^8.0.0
symfony/console Version ^6.2
symfony/lock Version ^6.2
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 valantic/pimcore-elastica-bridge contains the following files

Loading the files please wait ....