I'm trying to add Lucene search to my ZF2 project. The package is not listed on the ZF2 packages page. I tried to workaround this by installing it manually from GitHub.
I added this to my composer.json:
"repositories": [{
"type": "package",
"package": {
"name": "zendframework/zendsearch",
"version": "0.1",
"source": {
"url": "https://github.com/zendframework/ZendSearch.git",
"type": "git",
"reference": "master"
}
}
}]
and installed it via composer.phar:
$ ./composer.phar require zendframework/zendsearch:0.1
This installed the package but the autoloading doesn't work. Did anyone get ZendSearch working within the ZF2 skeleton application?
Have a look at the ZendSearch composer.json. Specifically, the autoload
section:
"autoload": {
"psr-0": {
"ZendSearch": "library/"
}
}
You need that in your 'package' to get autoloading working (in fact your package should be as close as possible to the real composer.json).
This ended up working for me:
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
},
{
"type": "package",
"package": {
"name": "zendframework/zendsearch",
"version": "0.1",
"source": {
"url": "https://github.com/zendframework/ZendSearch.git",
"type": "git",
"reference": "master"
}
}
}
],
"autoload": {
"psr-0": {
"ZendSearch\\": "vendor/zendframework/zendsearch/library/"
}
}
This worked for me
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.3.*",
"zendframework/zendsearch": "dev-master"
},
"autoload": {
"psr-0": {
"ZendSearch\\": "vendor/zendframework/zendsearch/library/"
}
}