Laravel Scout for the PHP Search API

Laravel + Algolia

Algolia API client for Laravel Framework (PHP)

Sign up

Features

  • Made to simplify the usage of Algolia’s API within the Laravel Framework

  • Built on top of the latest release of Laravel Scout, extending Scout’s search features

  • Zero downtime reimports, aggregators

  • Powers Laravel’s docs

  • Background retry strategy to ensure uptime

  • Seamless batching via iterators to optimize number of network calls

  • Zero downtime reindexing feature

  • API access to all Algolia functionality, AI products, and advanced features, including Recommend

Version

  • Requires: PHP 7.3+, Laravel 6+

Related Integrations

  • PHP API Client, Autocomplete, InstantSearch

Get started

  • Install (get a free account here.)
    1
    composer require algolia/scout-extended
  • Index
    1
    //intialize data
    2
    namespace App;
    3
    4
    use Laravel\Scout\Searchable;
    5
    use Illuminate\Database\Eloquent\Model;
    6
    7
    class Article extends Model
    8
    {
    9
        use Searchable;
    10
    }
    11
    12
    // update
    13
    class ArticleController extends Controller
    14
    {
    15
        public function update(Request $request, $id)
    16
        {
    17
            Article::find(request('id'));
    18
            $article->title = request('title');
    19
            $article->update();
    20
        }
    21
    }
  • Search
    1
    Route::get('search', function() {
    2
        $query = 'jimmie'; // <-- Change the query for testing.
    3
    4
        $articles = App\Article::search($query)->get();
    5
    6
        return $articles;
    7
    });
Get started for free
Explore developer docs