Skip to content

Commit 490f220

Browse files
authored
Merge devloops changes
2 parents 9c49d71 + 9d21069 commit 490f220

File tree

9 files changed

+599
-157
lines changed

9 files changed

+599
-157
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,22 @@ This package makes it easy to add full text search support to your models with L
2222

2323

2424
## Installation
25+
The Typesense PHP SDK uses httplug to interface with various PHP HTTP libraries through a single API.
2526

26-
You can install the package via composer:
27+
First, install the correct httplug adapter based on your `guzzlehttp/guzzle` version. For example, if you're on
28+
Laravel 8, which includes Guzzle 7, then run this:
2729

28-
``` bash
30+
```bash
31+
composer require php-http/guzzle7-adapter
32+
```
33+
34+
Then install the driver:
35+
36+
```bash
2937
composer require typesense/laravel-scout-typesense-driver
3038
```
3139

32-
Add the service provider:
40+
And add the service provider:
3341

3442
```php
3543
// config/app.php
@@ -49,7 +57,7 @@ Ensure you have Laravel Scout as a provider too otherwise you will get an "unres
4957
],
5058
```
5159

52-
Add `SCOUT_DRIVER=typesense` to your `.env` file
60+
Add `SCOUT_DRIVER=typesense` to your `.env` file
5361

5462
Then you should publish `scout.php` configuration file to your config directory
5563

@@ -187,7 +195,6 @@ $todos->searchable();
187195
and changing the config/scout.php config key from `typesensesearch` to `typesense`
188196
- Instead of importing `Devloops\LaravelTypesense\*`, you should import `Typesense\LaravelTypesense\*`
189197
- Instead of models implementing `Devloops\LaravelTypesense\Interfaces\TypesenseSearch`, they should implement `Typesense\LaravelTypesense\Interfaces\TypesenseDocument`
190-
- In the rare case where the `TypesenseEngine` method `delete` is called directly, all the model instances passed to the method must now belong to the same Typesense index
191198

192199
## Authors
193200
This package was originally authored by [Abdullah Al-Faqeir](https://github.com/AbdullahFaqeir) and his company DevLoops: https://github.com/devloopsnet/laravel-scout-typesense-engine. It has since been adopted into the Typesense Github org.

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
"illuminate/support": "^7.0|^8.0",
5050
"typesense/typesense-php": "^4.0"
5151
},
52+
"config": {
53+
"platform": {
54+
"php": "8.0"
55+
}
56+
},
5257
"suggest": {
5358
"typesense/typesense-php": "Required to use the Typesense php client."
5459
},
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Typesense\LaravelTypesense\Classes;
4+
5+
/**
6+
* Class TypesenseDocumentIndexResponse.
7+
*
8+
* @date 02/10/2021
9+
*
10+
* @author Abdullah Al-Faqeir <abdullah@devloops.net>
11+
*/
12+
class TypesenseDocumentIndexResponse
13+
{
14+
public function __construct(private ?int $code, private bool $success, private ?string $error = null, private ?array $document = null)
15+
{
16+
}
17+
18+
/**
19+
* @return int|null
20+
*/
21+
public function getCode(): ?int
22+
{
23+
return $this->code;
24+
}
25+
26+
/**
27+
* @return bool
28+
*/
29+
public function isSuccess(): bool
30+
{
31+
return $this->success;
32+
}
33+
34+
/**
35+
* @return string|null
36+
*/
37+
public function getError(): ?string
38+
{
39+
return $this->error;
40+
}
41+
42+
/**
43+
* @return array|null
44+
*/
45+
public function getDocument(): ?array
46+
{
47+
return $this->document;
48+
}
49+
}

0 commit comments

Comments
 (0)