Skip to content

Instantly share code, notes, and snippets.

@PierreLebedel
Last active March 28, 2025 19:54
Show Gist options
  • Save PierreLebedel/a338b6f4209287814d35016f2915d92d to your computer and use it in GitHub Desktop.
Save PierreLebedel/a338b6f4209287814d35016f2915d92d to your computer and use it in GitHub Desktop.
Laravel 12 Meilisearch command for "composer run dev"
MEILISEARCH_HOST=http://127.0.0.1:7700
MEILISEARCH_KEY=masterKey
MEILISEARCH_BIN="C:\\path\\to\\meilisearch\\bin" # Add this
{
"scripts": {
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fdba74,#e41359\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" \"php artisan app:meilisearch-run\" --names='server,queue,vite,meilisearch'"
]
},
}
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Process;
class MeilisearchRunCommand extends Command
{
protected $signature = 'app:meilisearch-run';
protected $description = 'Starts and runs the Meilisearch binary';
public function handle()
{
$binPath = config('scout.meilisearch.bin_path');
if(!$binPath){
$this->error("Meilisearch binary path not provided. Please add it to your .env & config/scout.php files.");
return self::INVALID;
}
$this->line("Meilisearch binary path provided. Go to ".config('scout.meilisearch.host')." to see the dashboard.");
Process::forever()
->path($binPath)
->run('meilisearch --master-key="'.config('scout.meilisearch.key').'"');
}
}
'meilisearch' => [
'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
'key' => env('MEILISEARCH_KEY'),
'bin_path' => env('MEILISEARCH_BIN'), // Asdd this
'index-settings' => [],
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment