Demo Dynamic Web Lab

Overview

A seamless Laravel integration package for the SearchJet WordPress plugin. This package allows you to use SearchJet’s powerful search capabilities directly within your Laravel application, providing a fluent, Laravel-like API for performing searches and managing indexes. The package bridges your Laravel application with a WordPress installation that has the SearchJet plugin active. It handles the HTTP […]

Step-by-Step Installation & Configuration

Step 1: Install the Package via Composer Open your terminal, navigate to your Laravel project directory, and run the following command: bash composer require maidulcu/laravel-searchjetengine Step 2: Publish the Configuration File Publish the package configuration file to your Laravel application’s config directory. bash php artisan vendor:publish –provider=”Maidul\SearchJet\SearchJetServiceProvider” This will create a new file: config/searchjet.php. Step 3: Configure Environment […]

Basic Usage

Performing a Simple Search The most straightforward way to search is using the search method. SearchJet automatically searches through Gutenberg block content. Example: Search for “Laravel” in Gutenberg content php <?php namespace App\Http\Controllers; use Maidul\SearchJet\SearchJet; class SearchController extends Controller { public function index(SearchJet $searchJet) { $query = request(‘q’); // Perform a simple search (includes Gutenberg blocks) $results […]

Error Handling

It’s good practice to handle potential errors, such as connection timeouts or invalid API credentials. php use Illuminate\Support\Facades\Log; use Maidul\SearchJet\Exceptions\SearchJetException; try { $results = $searchJet->search($query)->paginate(10); } catch (SearchJetException $e) { // Log the error for debugging Log::error(‘SearchJet search failed: ‘ . $e->getMessage()); // Return a user-friendly message return back()->with(‘error’, ‘Sorry, the search is temporarily unavailable.’); […]

API Reference

For a complete list of all available methods and configuration options, please refer to the source code or run php artisan vendor:publish to examine the configuration file closely.

Support

If you encounter any issues or have questions: