Download the PHP package sammaye/yii2-solr without Composer

On this page you can find all versions of the php package sammaye/yii2-solr. 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 yii2-solr

yii2-solr

A Yii2 Solr Extension built on top of Solarium.

Essentially this is a Yii2 plugin for Solarium and it is dirt simple to use, all it does is abstract certain parts of Solarium into Yii2.

There are only two files you need to pay attention to in this repository:

Normal querying of Solr is very simple with this extension and I will in fact point you towards the Solarium Documentation.

The only part Yii2 really has is in providing the Solarium client class as a application component, to show an example:

That is what it takes to query Solarium. As you notice the only part of the Solarium documentation you need to replace is where they use $client and instead you should use Yii::$app->solr (or whatever you have called the Solr application component in your configuration).

To setup the application you merely add it to your configuration. As an example:

The options part of the configuration is a one-to-one match to Solariums own constructor and options.

Using the data provider for widgets is just as easy, as another example:

As you will notice the Solarium query object can go straight into the data providers query property. Just like in Yii1 you need to provide a modelClass since this extension is not connected to active record directly.

The reasoning for not implementing a QueryInterface and making the query hook into an active record is because in many cases the Solr index represents many active records all at once as such I wanted to make it free form and give the user the ability to produce a specific Solr model that can return any active record they see fit while the data provider just feeds the multiple classes into a widget.

So now the basics are understood, you will see there are two others files:

The Solr class is just a helper that you don't really need if you don't want it so I will move onto the SolrDocumentInterface. The interface class just defines a single function populateFromSolr which takes one argument: the Solarium document object (from a loop). It returns a single Yii2 model. The populateFromSolr function is called every iteration of the data providers prepareModels() function and only ever takes a single document.


All versions of yii2-solr with dependencies

PHP Build Version
Package Version
Requires solarium/solarium Version ~6.0
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 sammaye/yii2-solr contains the following files

Loading the files please wait ....