- How do I install sti3bas/laravel-scout-array-driver in a Laravel app?
- Install it with Composer, usually as a dev dependency: composer require --dev sti3bas/laravel-scout-array-driver. Then point Scout at the array driver in the environment where you want it, for example SCOUT_DRIVER=array in phpunit.xml or your .env.testing file. No service to provision, no credentials, and no migrations are required.
- Which Laravel and Laravel Scout versions does this array driver support?
- Version 5.0 is aimed at Laravel Scout 11 on Laravel 10/11 with PHP 8.1+, based on the changelog note about fixing ArrayEngine compatibility with Scout 11's where/orderBy builder format. Applications still on Scout 10 or earlier likely need to stay on the 4.x line. Check the composer.json of the exact release you install, because the package major and the Scout major move together.
- Can I use this package to test Laravel Scout search without Meilisearch or Algolia?
- Yes, automated tests are its primary use case. The array engine indexes models into an in-memory PHP array, so Scout's search API, where clauses, ordering, and pagination all work without an external search service. That keeps your test suite fast and your CI jobs free of search-service dependencies.
- How do I configure the array driver in config/scout.php?
- Set the driver value to array, for example 'driver' => env('SCOUT_DRIVER', 'array'). In tests, define SCOUT_DRIVER=array in phpunit.xml or your .env.testing file so staging and production keep their real engine. Switching back to Meilisearch, Algolia, Typesense, or the database engine is just a config change.
- Does the array driver support where clauses, orderBy, and pagination like a real Scout engine?
- Yes, the package supports Scout's where clauses, ordering, and pagination against the in-memory array. The v5.0 release specifically fixed ArrayEngine compatibility with Scout 11's where/orderBy builder format. Support for newer Scout builder internals can lag until a matching package release ships.
- Is sti3bas/laravel-scout-array-driver safe to use in production?
- No, it is not a production search backend. The index lives in a PHP array per process, so it is not shared across workers, not persistent, and not designed for large datasets. Use it for tests, local development, seed or demo data, and CI, and keep a real engine such as Meilisearch, Algolia, Typesense, or the database engine in production.
- Why am I getting where/orderBy errors with Laravel Scout 11 and the array driver?
- Scout 11 changed its where/orderBy builder format, which broke earlier versions of this package. The v5.0 release (fix #34) updates ArrayEngine to match that format. Upgrade to the latest release and confirm the package major version matches your Scout major version.
- What are the alternatives to this array driver for testing Laravel Scout?
- Laravel Scout ships with collection and null engines, and the database engine can work for small local datasets. You can also mock the Scout engine contract directly in unit tests. This package sits in the middle by keeping real Scout query behavior without external infrastructure.
- Do I need to run migrations or rebuild an index to use the array driver?
- No. The engine is populated in memory as models are indexed during the current process, so there are no migrations, no backfill, and no external index to rebuild. In tests, make sure models are indexed before asserting on results.
- Will tests that pass with the array driver also pass against Meilisearch or Algolia?
- Not guaranteed. The array engine simulates Scout's engine contract, but real engines can differ in query construction, ranking, and edge-case behavior, so a passing array-driver test does not prove production parity. Keep a small integration test suite pointed at your real engine in staging or CI.