PHP Classes

Laravel ElasticSearch Application with Docker: Setup a Laravel ElasticSearch app using Docker

Recommend this page to a friend!
  Info   View files Documentation   View files View files (94)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-04-26 (17 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 17 This week: 4All time: 10,604 This week: 45Up
Version License PHP version Categories
laravel-docker-elast 1.0The PHP License5PHP 5, Searching, Systems administration, L...
Description Author

This package can be used to demonstrate how to set up a Laravel ElasticSearch application using Docker.

It provides an example application that uses an ElasticSearch server to perform a search in a Laravel application.

The package provides all the files to set up Docker to deploy the application using a Docker container.

Innovation Award
PHP Programming Innovation award nominee
April 2022
Nominee
Vote
ElasticSearch is an application to index and efficiently search content.

It provides a server that PHP applications can connect to perform searches from separate machines. This possibility allows for the development of more scalable applications.

This package provides an example of setting up a Docker container of a Laravel application that developers can use to learn how to create applications that can run on multiple servers.

Manuel Lemos
Picture of Nahidul Hasan
  Performance   Level  
Innovation award
Innovation award
Nominee: 5x

 

Details

Laravel-docker-elasticsearch

This is a simple repo for practicing elasticsearch with laravel and docker.

What is Elasticsearch?

Elasticsearch is an open-source, RESTful, distributed search and analytics engine built on Apache Lucene. Since the first version of Elasticsearch was released in 2010, it has quickly become the most popular search engine, and is commonly used for log analytics, full-text search, and operational intelligence use cases.

In this repo you will get how you will use elasticsearch with laravel and docker.

First you have to add elastic search image in docker-compose file.

For Example :

elasticsearch:
      image: elasticsearch
      ports:
          - "9200:9200"

Before running docker compose you have to sure that docker memory size >= 4.0 GB. Otherwise, the elastic search will not run properly.

Now you have to update composer.json file.


"require": {      
        "elasticsearch/elasticsearch": "^5.2"  
    }

All the above things I have done in this repo. For running this project just follow the following step:

clone the repo 

From the project directory run the following command:

composer update

Now increase docker memory size, restart docker and run the following commands

docker-compose build

docker-compose up -d

Now run the migration commmand:

php artisan migrate

Now you can brows the project and create post from this url

http://localhost:9000/posts/create

Now you can search using elastic search. In app elastic folder you will get elastic class. Here I have implement elastic client.

If you want to add demo data for Post then run the following command:

docker-compose exec php php artisan tinker

factory(App\Post::class, 50)->create();
  Files folder image Files  
File Role Description
Files folder imageapp (3 files, 5 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (13 files)
Files folder imagedatabase (3 directories)
Files folder imagedocker (2 directories)
Files folder imagepublic (4 files, 2 directories)
Files folder imageresources (3 directories)
Files folder imageroutes (4 files)
Files folder imagetests (2 files, 2 directories)
Accessible without login Plain text file .env.example Data Auxiliary data
Plain text file artisan Class Class source
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file readme.md Doc. Documentation
Accessible without login Plain text file server.php Aux. Auxiliary script
Accessible without login Plain text file webpack.mix.js Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:17
This week:4
All time:10,604
This week:45Up

For more information send a message to info at phpclasses dot org.