Libraries available for PHP-Solr integration
Every call to Solr for executing any task is eventually a URL which needs particular parameters depending on what we need to get done. So, adding documents to Solr, deleting documents from Solr, and searching of documents can all be done by building URLs with parameters for their respective commands. We can call these URLs using PHP and cURL and interpret the response in JSON. However, instead of remembering every command to be sent in the URL, we can use a library to create the Solr URL and interpret the response. Some of the libraries available are as follows:
Solr-PHP-client
Apache Solr-PHP extension
Solarium
Solr-PHP-client can be obtained from the following location:
https://code.google.com/p/solr-php-client/
It can be seen that the latest release for this library was in November 2009. There have been no developments on this library since 2009. This is a very basic client and does not support a lot of features that are now available in Solr.
Apache SolrPhp extension can be obtained from the following location:
http://pecl.php.net/package/solr
The latest release for this library was in November 2011. This is a comparatively better library. And is also the library suggested for integrating with Solr on www.php.net. It is intended to be very fast and lightweight compared to others. The complete API of the library can be obtained from following location:
http://php.net/manual/en/book.solr.php
Solarium is the latest library for Solr PHP integration. It is open source and is continuously updated. It is fully object oriented and provides features almost as soon as they are made available in Solr. It is fully flexible where you can add a functionality that you feel is missing. Also custom parameters can be used to achieve almost any task. On the downside, the library is somewhat heavy as it has many files. Solarium replicates the concepts of Solr to some extent. And it is being actively developed. We will install Solarium and explore the comprehensive list of features of Solr via PHP code using the Solarium library.