Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
51a6dee
Add Scout package structure and abstract Engine class
binaryfire Dec 31, 2025
bd6f86e
Add SearchableInterface contract
binaryfire Dec 31, 2025
ba47453
Add EngineManager with static engine caching
binaryfire Dec 31, 2025
3b6a1d9
Add Builder search query builder
binaryfire Dec 31, 2025
0b3e1ad
Add Searchable trait with coroutine-safe sync disable
binaryfire Dec 31, 2025
e5ab651
Add SearchableScope and batch import events
binaryfire Dec 31, 2025
79f53b4
Add Scout configuration file
binaryfire Dec 31, 2025
8d20696
Add ScoutServiceProvider
binaryfire Dec 31, 2025
c560016
Add NullEngine for disabling search
binaryfire Dec 31, 2025
9309738
Add CollectionEngine for in-memory search
binaryfire Dec 31, 2025
923b0ae
Add MeilisearchEngine with tenant token support
binaryfire Dec 31, 2025
1fa4df7
Add queue jobs for searchable operations
binaryfire Dec 31, 2025
d9947b4
Add UpdatesIndexSettings contract and ScoutException
binaryfire Dec 31, 2025
52416ef
Add FlushCommand for clearing search index
binaryfire Dec 31, 2025
c620104
Add ImportCommand for bulk indexing
binaryfire Dec 31, 2025
1d0e192
Add IndexCommand for creating search indexes
binaryfire Dec 31, 2025
061b777
Add DeleteIndexCommand for removing search indexes
binaryfire Dec 31, 2025
5cf405e
Add SyncIndexSettingsCommand for syncing index settings
binaryfire Dec 31, 2025
fd9834f
Add Scout test fixtures
binaryfire Dec 31, 2025
11a6b53
Fix imports to follow Hypervel patterns
binaryfire Dec 31, 2025
56bbe4e
Add Scout package to composer.json and add NullEngineTest
binaryfire Dec 31, 2025
ced0a87
Add Scout test infrastructure and CollectionEngineTest
binaryfire Dec 31, 2025
7849234
Add MeilisearchEngineTest with 26 test cases
binaryfire Dec 31, 2025
02c3159
Add BuilderTest with 30 test cases
binaryfire Dec 31, 2025
bc4c4d3
Add EngineManagerTest with 16 test cases
binaryfire Dec 31, 2025
651dad7
Add SearchableModelTest with 15 test cases
binaryfire Dec 31, 2025
c0bd17e
Add CoroutineSafetyTest with 4 test cases
binaryfire Dec 31, 2025
115e542
Fix tests and phpstan errors
binaryfire Dec 31, 2025
43aa237
Improve Scout package with Laravel API parity and fixes
binaryfire Dec 31, 2025
4ddd084
Add after_commit support for queued Scout operations
binaryfire Dec 31, 2025
5cadc19
Fix tests and phpstan errors
binaryfire Dec 31, 2025
8525f4a
Fix bulk import concurrency and makeSearchableUsing behavior
binaryfire Dec 31, 2025
2893f6e
Guard SCOUT_COMMAND define against redefinition warning
binaryfire Dec 31, 2025
d0c3c67
Add tests for RemoveableScoutCollection and RemoveFromSearch job
binaryfire Dec 31, 2025
9ac61e2
Add DatabaseEngine and TypesenseEngine to Scout
binaryfire Jan 1, 2026
136cd76
Apply php-cs-fixer formatting
binaryfire Jan 1, 2026
0a509c8
Add EngineManager and TypesenseEngine tests, fix Scout package metadata
binaryfire Jan 1, 2026
0123320
Fix Scout package issues identified in code review
binaryfire Jan 1, 2026
0995b27
Resolve TypesenseClient from container for DI consistency
binaryfire Jan 1, 2026
eedebab
Add tests for SearchUsingPrefix attribute and SearchableScope macros
binaryfire Jan 1, 2026
7f74f7d
Fix shouldBeSearchable test to verify actual filtering behavior
binaryfire Jan 1, 2026
04bbc03
Add integration test infrastructure for Meilisearch and Typesense
binaryfire Jan 1, 2026
00373df
Add comprehensive Scout integration tests for Meilisearch and Typesense
binaryfire Jan 1, 2026
d3f934f
Fix Scout command concurrent execution with proper waiting
binaryfire Jan 1, 2026
a472bb3
Refactor Scout test infrastructure and simplify ImportCommand
binaryfire Jan 1, 2026
549578d
Add config tests and fix TypesenseEngine maxTotalResults enforcement
binaryfire Jan 1, 2026
7778d1d
Simplify Scout searchable job execution
binaryfire Jan 3, 2026
4d99d55
Fix code style in Searchable trait
binaryfire Jan 3, 2026
62d1d7a
Merge main into feature/scout
binaryfire Jan 3, 2026
ab69e84
Test: remove bootstrap to debug CI failure
binaryfire Jan 3, 2026
6534852
Revert bootstrap removal - not the cause
binaryfire Jan 3, 2026
7a1df85
Test: revert HasAttributes change to debug CI failure
binaryfire Jan 3, 2026
b9a8323
Revert HasAttributes revert - not the cause
binaryfire Jan 3, 2026
44338f0
Merge branch 'main' into feature/scout
binaryfire Jan 8, 2026
43b6e75
Update README
binaryfire Jan 8, 2026
969752c
Add DeleteAllIndexesCommand and PaginatesEloquentModels contract
binaryfire Jan 8, 2026
e9b45bc
Add tests for pagination contract delegation in Builder
binaryfire Jan 8, 2026
2f076e3
Add unit tests for ImportCommand and SyncIndexSettingsCommand
binaryfire Jan 8, 2026
b10df66
Add Scout utility class for customizable job dispatch
binaryfire Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Integration Tests
# Copy this file to .env and configure to run integration tests locally.
# Tests are skipped by default. Set the RUN_*_INTEGRATION_TESTS vars to enable.

# Meilisearch Integration Tests
RUN_MEILISEARCH_INTEGRATION_TESTS=false
MEILISEARCH_HOST=127.0.0.1
MEILISEARCH_PORT=7700
MEILISEARCH_KEY=secret

# Typesense Integration Tests
RUN_TYPESENSE_INTEGRATION_TESTS=false
TYPESENSE_HOST=127.0.0.1
TYPESENSE_PORT=8108
TYPESENSE_API_KEY=secret
TYPESENSE_PROTOCOL=http
78 changes: 77 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,80 @@ jobs:
- name: Execute tests
run: |
PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --diff
vendor/bin/phpunit -c phpunit.xml.dist
vendor/bin/phpunit -c phpunit.xml.dist --exclude-group integration

meilisearch_integration_tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"

name: Integration (Meilisearch)

services:
meilisearch:
image: getmeili/meilisearch:latest
env:
MEILI_MASTER_KEY: secret
MEILI_NO_ANALYTICS: true
ports:
- 7700:7700
options: >-
--health-cmd "curl -f http://localhost:7700/health"
--health-interval 10s
--health-timeout 5s
--health-retries 5

container:
image: phpswoole/swoole:6.0.2-php8.4

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist -n -o

- name: Execute Meilisearch integration tests
env:
RUN_MEILISEARCH_INTEGRATION_TESTS: true
MEILISEARCH_HOST: meilisearch
MEILISEARCH_PORT: 7700
MEILISEARCH_KEY: secret
run: |
vendor/bin/phpunit -c phpunit.xml.dist --group meilisearch-integration

typesense_integration_tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"

name: Integration (Typesense)

services:
typesense:
image: typesense/typesense:27.1
env:
TYPESENSE_API_KEY: secret
TYPESENSE_DATA_DIR: /tmp
ports:
- 8108:8108

container:
image: phpswoole/swoole:6.0.2-php8.4

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist -n -o

- name: Execute Typesense integration tests
env:
RUN_TYPESENSE_INTEGRATION_TESTS: true
TYPESENSE_HOST: typesense
TYPESENSE_PORT: 8108
TYPESENSE_API_KEY: secret
TYPESENSE_PROTOCOL: http
run: |
vendor/bin/phpunit -c phpunit.xml.dist --group typesense-integration
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
composer.lock
/phpunit.xml
.phpunit.result.cache
.env
!tests/Foundation/fixtures/hyperf1/composer.lock
tests/Http/fixtures
.env
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Hypervel\\Redis\\": "src/redis/src/",
"Hypervel\\Router\\": "src/router/src/",
"Hypervel\\Sanctum\\": "src/sanctum/src/",
"Hypervel\\Scout\\": "src/scout/src/",
"Hypervel\\Session\\": "src/session/src/",
"Hypervel\\Socialite\\": "src/socialite/src/",
"Hypervel\\Support\\": "src/support/src/",
Expand Down Expand Up @@ -174,6 +175,7 @@
"hypervel/queue": "self.version",
"hypervel/redis": "self.version",
"hypervel/router": "self.version",
"hypervel/scout": "self.version",
"hypervel/session": "self.version",
"hypervel/socialite": "self.version",
"hypervel/support": "self.version",
Expand All @@ -194,7 +196,9 @@
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.2).",
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.2).",
"ably/ably-php": "Required to use the Ably broadcast driver (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0)."
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
"meilisearch/meilisearch-php": "Required to use the Meilisearch Scout driver (^1.16).",
"typesense/typesense-php": "Required to use the Typesense Scout driver (^5.2)."
},
"require-dev": {
"ably/ably-php": "^1.0",
Expand All @@ -211,14 +215,16 @@
"league/flysystem-google-cloud-storage": "^3.0",
"league/flysystem-path-prefixing": "^3.3",
"league/flysystem-read-only": "^3.3",
"meilisearch/meilisearch-php": "^1.16",
"mockery/mockery": "1.6.x-dev",
"nunomaduro/collision": "^8.5",
"pda/pheanstalk": "v5.0.9",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "10.5.45",
"pusher/pusher-php-server": "^7.2",
"swoole/ide-helper": "~5.1.0",
"symfony/yaml": "^7.3"
"symfony/yaml": "^7.3",
"typesense/typesense-php": "^5.2"
},
"config": {
"sort-packages": true
Expand Down Expand Up @@ -260,6 +266,7 @@
"hypervel": {
"providers": [
"Hypervel\\Notifications\\NotificationServiceProvider",
"Hypervel\\Scout\\ScoutServiceProvider",
"Hypervel\\Telescope\\TelescopeServiceProvider",
"Hypervel\\Sentry\\SentryServiceProvider"
]
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ parameters:
- '#Call to an undefined method Hyperf\\Database\\Query\\Builder::firstOrFail\(\)#'
- '#Access to an undefined property Hyperf\\Collection\\HigherOrderCollectionProxy#'
- '#Call to an undefined method Hyperf\\Tappable\\HigherOrderTapProxy#'
- '#Trait Hypervel\\Scout\\Searchable is used zero times and is not analysed#'
- message: '#.*#'
paths:
- src/core/src/Database/Eloquent/Builder.php
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
bootstrap="tests/bootstrap.php"
beStrictAboutTestsThatDoNotTestAnything="false"
colors="true"
processIsolation="false"
Expand Down
23 changes: 23 additions & 0 deletions src/scout/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License (MIT)

Copyright (c) Taylor Otwell

Copyright (c) Hypervel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 4 additions & 0 deletions src/scout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Scout for Hypervel
===

[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/hypervel/scout)
58 changes: 58 additions & 0 deletions src/scout/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "hypervel/scout",
"type": "library",
"description": "Full-text search for Eloquent models.",
"license": "MIT",
"keywords": [
"php",
"hypervel",
"scout",
"search",
"full-text-search",
"meilisearch",
"typesense",
"database"
],
"authors": [
{
"name": "Albert Chen",
"email": "albert@hypervel.org"
}
],
"support": {
"issues": "https://github.com/hypervel/components/issues",
"source": "https://github.com/hypervel/components"
},
"autoload": {
"psr-4": {
"Hypervel\\Scout\\": "src/"
}
},
"require": {
"php": "^8.2",
"hypervel/config": "^0.3",
"hypervel/console": "^0.3",
"hypervel/core": "^0.3",
"hypervel/coroutine": "^0.3",
"hypervel/event": "^0.3",
"hypervel/queue": "^0.3",
"hypervel/support": "^0.3"
},
"suggest": {
"meilisearch/meilisearch-php": "Required for Meilisearch driver (^1.0)",
"typesense/typesense-php": "Required for Typesense driver (^5.2)"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-main": "0.3-dev"
},
"hypervel": {
"providers": [
"Hypervel\\Scout\\ScoutServiceProvider"
]
}
}
}
Loading