Hands On tutorial ElasticSearch from PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
doc
meta
public
resources/view
scripts
src
.gitignore
README.md
composer.json
composer.phar

README.md

Hands On tutorial ElasticSearch from PHP

Cool Dine

ElasticSearch provides a very powerfull search engine and a simple php client, but the documentation on practical use in php is limited. In his talk on the Laravel Meetup Groningen Peter Steenbergen filled the gap: He explained the internals of the search and filtering page of shop application in PHP using Laravel and vue.js. His code is remarkably simple but what is does is surprisingly cool!

This hands-on provides skeleton and instructions for building such a page yourself. To reach an audience as large as possible it works without application frameworks, just PHP, HTML, CSS and a little bit of javascript. Instead of a shop it results in a restaurant search page that includes filtering by geograpical location als well as by features and price.

DOCUMENTATION

You are advised to read the documentation and follow instruction in the following order:

FEATURES

  • simple PHP application requires no prior knowledge of application or front end frameworks
  • uses elasticsearch php client but includes hints on Elastica library
  • creates ElasticSearch index and mapping using language-specific (dutch) analyzers,
  • normalizes entities and insert them in the index,
  • search using multi_match
  • filter using terms, range and geographical distance
  • global, bucket end stats aggregations
  • follows patterns: builder, service provider, entity, seeder, valueobject and dependency injection

REQUIREMENTS

  • PHP >=7.0,
  • ElasticSearch (link to installation instructions included)
  • basic knowledge of PHP, git and composer
  • uses a little bit of javascript and jquery

Tested with PHP 7.0 and ElasticSearch 6.4.0

LIMITATIONS

  • Just a single page, therefore no routing
  • All services are only provided once, therefore no service container
  • Not fully SOLID: view 'Rendering' inlined in AbstractController, should have a seperate class
  • Security: not all input is fully validated
  • The Solutions for Elastica are not fully complete, not tested

RELEASE NOTES

This is a pre-release version under development.

COPYRIGHT, LICENCE AND DISCLAIMER

The code in this bundle was based on CoolShop from Peter Steenbergen Modifications and additions are Copyricht (c) MetaClass, Groningen, 2018.

This bundle is under the MIT license. See the complete license in the bundle

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.