mailerlite / laravel-elasticsearch

An easy way to use the official Elastic Search client in your Laravel applications.
MIT License
918 stars 187 forks source link

I can't get to work with Facades #44

Closed pildit closed 6 years ago

pildit commented 6 years ago

Hi, I'm trying to use the Elasticsearch facade into my Lumen app but no luck!

I followed the instructions but i get this error message :

"Type error: Argument 1 passed to Cviebrock\LaravelElasticsearch\Manager::__construct() must be an instance of Illuminate\Contracts\Foundation\Application, instance of Laravel\Lumen\Application given, called in C:\xampp\htdocs\lf-api\vendor\cviebrock\laravel-elasticsearch\src\ServiceProvider.php on line 49"

Here is a cut from my composer.json "require": { "php": ">=5.6.4", "laravel/lumen-framework": "5.4.*", "vlucas/phpdotenv": "~2.2", "krisanalfa/lumen-dingo-adapter": "^0.0.3", "league/fractal": "^0.17.0", "cviebrock/laravel-elasticsearch": "2" },

petercoles commented 6 years ago

It appears that your project is locked to version 2 of this package and the fix you need is in version 3.1, so a simple upgrade to the latest version should clear this for you.

pildit commented 6 years ago

Ok, thanks. But now I receive some composer errors when i run composer update

Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Conclusion: remove illuminate/contracts v5.4.36
  • Conclusion: remove laravel/lumen-framework v5.4.7
  • Conclusion: don't install laravel/lumen-framework v5.4.7
  • Conclusion: don't install laravel/lumen-framework v5.4.6
  • Conclusion: don't install laravel/lumen-framework v5.4.5
  • Conclusion: don't install laravel/lumen-framework v5.4.4
  • Conclusion: don't install laravel/lumen-framework v5.4.3
  • Conclusion: don't install laravel/lumen-framework v5.4.2
  • Conclusion: don't install laravel/lumen-framework v5.4.1
  • Conclusion: don't install laravel/lumen-framework v5.4.0
  • Conclusion: don't install illuminate/contracts v5.4.36
petercoles commented 6 years ago

Ah yes. Version 3 of the package requires Laravel Support 5.5 or higher, in effect Lumen 5.5 or higher. This was done when the Lumen support was overhauled last year.

So you have two choices:

  1. fork the package and see whether it will work if you reduce the version needed in your fork's composer.json, or
  2. upgrade your version Lumen, which is straightforward to go from 5.4 to 5.5 and trivial to go from 5.5 to 5.6

The second option is way better than the first, but there would be a catch for you, namely that development of the krisanalfa/lumen-dingo-adapter seems to have ceased with Lumen 5.4, so you'll run into another clash there. A better alternative would be dusterio/lumen-passport for which development is ongoing.

pildit commented 6 years ago

Ok thank you, in fact I found another package for Lumen (basemkhirat/elasticsearch) which installed correctly