I am a little confused as to how to go about this but basically I am trying to integrate Elastic Search
into an existing mySQL
database. I've done a bit of research and discovered a PHP
Client called Elastica
which makes it easier to work with Elastic Search
. However I am having a bit of trouble installing it into my project so that I can use the library.
It recommends installing via Composer
but my project does not use this so that is not an option. It also mentions using the spl_autoload_register( )
function. I'm not entirely sure how to go about that.
They provide code on their website:
function __autoload_elastica ($class) {
$path = str_replace('\\', '/', substr($class, 1));
if (file_exists('/var/www/' . $path . '.php')) {
require_once('/var/www/' . $path . '.php');
}
}
spl_autoload_register('__autoload_elastica');
I'm having difficulty understanding where to place this code. I've placed the Elastica
library in C://wamp/www/myproject/includes/elastica so do I just place this code in my header and modify /var/www/ to match my location? Has anyone experience installing Elastica
without composer? How did you go about doing it or is it easier to integrate composer with the project and do it that way?
I'm sorry if this question seems stupid, I'm only out of college and currently in a company that is between lead developers so I've literally no direction or no body to ask, I need some guidance on this issue. Any help is much appreciated.