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  
Name: Nahidul Hasan <contact>
Classes: 8 packages by
Country: Bangladesh Bangladesh
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

  Files folder image Files  /  app  
File Role Description
Files folder imageConsole (1 file)
Files folder imageElastic (1 file)
Files folder imageExceptions (1 file)
Files folder imageHttp (1 file, 2 directories)
Files folder imageProviders (6 files)
  Plain text file Post.php Class Class source
  Plain text file User.php Class Class source
  Plain text file Worker.php Class Class source

  Files folder image Files  /  app  /  Console  
File Role Description
  Plain text file Kernel.php Class Class source

  Files folder image Files  /  app  /  Elastic  
File Role Description
  Plain text file Elastic.php Class Class source

  Files folder image Files  /  app  /  Exceptions  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  app  /  Http  
File Role Description
Files folder imageControllers (4 files, 1 directory)
Files folder imageMiddleware (5 files)
  Plain text file Kernel.php Class Class source

  Files folder image Files  /  app  /  Http  /  Controllers  
File Role Description
Files folder imageAuth (4 files)
  Plain text file Controller.php Class Class source
  Plain text file HomeController.php Class Class source
  Plain text file PostController.php Class Class source
  Plain text file UserController.php Class Class source

  Files folder image Files  /  app  /  Http  /  Controllers  /  Auth  
File Role Description
  Plain text file ForgotPasswordController.php Class Class source
  Plain text file LoginController.php Class Class source
  Plain text file RegisterController.php Class Class source
  Plain text file ResetPasswordController.php Class Class source

  Files folder image Files  /  app  /  Http  /  Middleware  
File Role Description
  Plain text file EncryptCookies.php Class Class source
  Plain text file RedirectIfAuthenticated.php Class Class source
  Plain text file TrimStrings.php Class Class source
  Plain text file TrustProxies.php Class Class source
  Plain text file VerifyCsrfToken.php Class Class source

  Files folder image Files  /  app  /  Providers  
File Role Description
  Plain text file AppServiceProvider.php Class Class source
  Plain text file AuthServiceProvider.php Class Class source
  Plain text file BroadcastServiceProvider.php Class Class source
  Plain text file ElasticServiceProvider.php Class Class source
  Plain text file EventServiceProvider.php Class Class source
  Plain text file RouteServiceProvider.php Class Class source

  Files folder image Files  /  bootstrap  
File Role Description
  Plain text file app.php Class Class source

  Files folder image Files  /  config  
File Role Description
  Plain text file app.php Class Class source
  Plain text file auth.php Class Class source
  Accessible without login Plain text file broadcasting.php Aux. Auxiliary script
  Accessible without login Plain text file cache.php Aux. Auxiliary script
  Accessible without login Plain text file database.php Aux. Auxiliary script
  Accessible without login Plain text file filesystems.php Aux. Auxiliary script
  Accessible without login Plain text file hashing.php Aux. Auxiliary script
  Plain text file logging.php Class Class source
  Accessible without login Plain text file mail.php Aux. Auxiliary script
  Accessible without login Plain text file queue.php Aux. Auxiliary script
  Plain text file services.php Class Class source
  Accessible without login Plain text file session.php Aux. Auxiliary script
  Accessible without login Plain text file view.php Aux. Auxiliary script

  Files folder image Files  /  database  
File Role Description
Files folder imagefactories (2 files)
Files folder imagemigrations (4 files)
Files folder imageseeds (1 file)

  Files folder image Files  /  database  /  factories  
File Role Description
  Plain text file PostFactory.php Class Class source
  Plain text file UserFactory.php Class Class source

  Files folder image Files  /  database  /  migrations  
File Role Description
  Plain text file 2014_10_12_000000_create_users_table.php Class Class source
  Plain text file 2014_10_12_100000_...rd_resets_table.php Class Class source
  Plain text file 2018_08_02_095452_create_posts_table.php Class Class source
  Plain text file 2018_08_07_090055_...e_workers_table.php Class Class source

  Files folder image Files  /  database  /  seeds  
File Role Description
  Plain text file DatabaseSeeder.php Class Class source

  Files folder image Files  /  docker  
File Role Description
Files folder imagenginx (2 files)
Files folder imagephp (2 files)

  Files folder image Files  /  docker  /  nginx  
File Role Description
  Accessible without login Plain text file default.conf Data Auxiliary data
  Accessible without login Plain text file nginx.conf Data Auxiliary data

  Files folder image Files  /  docker  /  php  
File Role Description
  Accessible without login Plain text file custom.ini Data Auxiliary data
  Accessible without login Plain text file Dockerfile Data Auxiliary data

  Files folder image Files  /  public  
File Role Description
Files folder imagecss (1 file)
Files folder imagejs (1 file)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file index.php Class Class source
  Accessible without login Plain text file robots.txt Doc. Documentation
  Accessible without login Plain text file web.config Data Auxiliary data

  Files folder image Files  /  public  /  css  
File Role Description
  Accessible without login Plain text file app.css Data Auxiliary data

  Files folder image Files  /  public  /  js  
File Role Description
  Accessible without login Plain text file app.js Data Auxiliary data

  Files folder image Files  /  resources  
File Role Description
Files folder imageassets (2 directories)
Files folder imagelang (1 directory)
Files folder imageviews (2 files, 3 directories)

  Files folder image Files  /  resources  /  assets  
File Role Description
Files folder imagejs (2 files, 1 directory)
Files folder imagesass (2 files)

  Files folder image Files  /  resources  /  assets  /  js  
File Role Description
Files folder imagecomponents (1 file)
  Accessible without login Plain text file app.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.js Data Auxiliary data

  Files folder image Files  /  resources  /  assets  /  js  /  components  
File Role Description
  Accessible without login Plain text file ExampleComponent.vue Data Auxiliary data

  Files folder image Files  /  resources  /  assets  /  sass  
File Role Description
  Accessible without login Plain text file app.scss Data Auxiliary data
  Accessible without login Plain text file _variables.scss Data Auxiliary data

  Files folder image Files  /  resources  /  lang  
File Role Description
Files folder imageen (4 files)

  Files folder image Files  /  resources  /  lang  /  en  
File Role Description
  Accessible without login Plain text file auth.php Aux. Auxiliary script
  Accessible without login Plain text file pagination.php Aux. Auxiliary script
  Accessible without login Plain text file passwords.php Aux. Auxiliary script
  Accessible without login Plain text file validation.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  
File Role Description
Files folder imageauth (2 files, 1 directory)
Files folder imagelayouts (2 files)
Files folder imageposts (2 files)
  Accessible without login Plain text file home.blade.php Aux. Auxiliary script
  Accessible without login Plain text file welcome.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  auth  
File Role Description
Files folder imagepasswords (2 files)
  Accessible without login Plain text file login.blade.php Aux. Auxiliary script
  Accessible without login Plain text file register.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  auth  /  passwords  
File Role Description
  Accessible without login Plain text file email.blade.php Aux. Auxiliary script
  Accessible without login Plain text file reset.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  layouts  
File Role Description
  Accessible without login Plain text file app.blade.php Aux. Auxiliary script
  Accessible without login Plain text file master.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  posts  
File Role Description
  Accessible without login Plain text file create.blade.php Aux. Auxiliary script
  Accessible without login Plain text file index.blade.php Aux. Auxiliary script

  Files folder image Files  /  routes  
File Role Description
  Accessible without login Plain text file api.php Example Example script
  Accessible without login Plain text file channels.php Example Example script
  Accessible without login Plain text file console.php Example Example script
  Accessible without login Plain text file web.php Example Example script

  Files folder image Files  /  tests  
File Role Description
Files folder imageFeature (1 file)
Files folder imageUnit (1 file)
  Plain text file CreatesApplication.php Class Class source
  Plain text file TestCase.php Class Class source

  Files folder image Files  /  tests  /  Feature  
File Role Description
  Plain text file ExampleTest.php Class Class source

  Files folder image Files  /  tests  /  Unit  
File Role Description
  Plain text file ExampleTest.php Class Class source

 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.