Skip to content
This repository was archived by the owner on May 13, 2021. It is now read-only.

Commit cd92536

Browse files
authored
Merge pull request #3 from meilisearch/readme-gha
Basic configurations
2 parents d0f6331 + 08b2fd3 commit cd92536

File tree

12 files changed

+81
-16
lines changed

12 files changed

+81
-16
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
end_of_line = lf
9+
charset = utf-8
10+
tab_width = 4
11+
indent_style = space
12+
13+
[*.php]
14+
indent_size = 4
15+
indent_style = space
16+
17+
[*.md]
18+
indent_style = space
19+
max_line_length = 80

.github/workflows/tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: Validate composer.json and composer.lock
11+
run: composer validate
12+
- name: Install dependencies
13+
run: composer install --prefer-dist --no-progress --no-suggest
14+
- name: Run test suite
15+
run: vendor/bin/phpunit --color tests/

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/vendor/
22
composer.lock
33
phpunit.xml
4-
.phpunit.result.cache
4+
.phpunit.result.cache

README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Laravel Scout MeiliSearch
22

33
[![Licence](https://img.shields.io/badge/licence-MIT-blue.svg)](https://img.shields.io/badge/licence-MIT-blue.svg)
4+
[![Actions Status](https://github.com/meilisearch/meilisearch-php/workflows/Tests/badge.svg)](https://github.com/meilisearch/meilisearch-php/actions)
5+
[![Latest Stable Version](https://poser.pugx.org/meilisearch/meilisearch-php/version)](https://packagist.org/packages/meilisearch/meilisearch-laravel-scout)
46

57
The Laravel scout package for MeiliSearch.
68

@@ -14,6 +16,7 @@ Here is the [MeiliSearch documentation](https://docs.meilisearch.com/) 📖
1416
- [Getting started](#getting-started)
1517
- [Compatibility with MeiliSearch](#compatibility-with-meilisearch)
1618
- [Additional notes](#additional-notes)
19+
- [Development Workflow](#development-workflow)
1720

1821
## Installation
1922

@@ -84,7 +87,7 @@ class BookController extends Controller
8487
$book = new Book();
8588
$book->title = 'Pride and Prejudice';
8689
...
87-
$book->save();
90+
$book->save();
8891
}
8992
}
9093
```
@@ -99,7 +102,7 @@ $ php artisan scout:import "App\Book"
99102
class BookController extends Controller
100103
{
101104
public function search()
102-
{
105+
{
103106
// MeiliSearch is typo-tolerant:
104107
Book::search('harry pottre')->get();
105108
// Or if you want to get the result from meilisearch:
@@ -114,11 +117,11 @@ class BookController extends Controller
114117
class BookController extends Controller
115118
{
116119
public function destroy($id)
117-
{
120+
{
118121
// Delete one document
119122
Book::find($id)->delete();
120123
// Delete several documents
121-
Book::destroy([1, 42]);
124+
Book::destroy([1, 42]);
122125
// Delete all documents /!\
123126
Book::query()->delete();
124127
}
@@ -144,10 +147,10 @@ All the supported options are described in [this documentation section](https://
144147
class BookController extends Controller
145148
{
146149
public function customSearch()
147-
{
150+
{
148151
Book::search('prince', function (Index $meilisearch, $query, $options) {
149152
$options['filters'] = 'author="Antoine de Saint-Exupéry"';
150-
153+
151154
return $meilisearch->search($query, $options);
152155
})->limit(3)->get();
153156
}
@@ -160,7 +163,7 @@ class BookController extends Controller
160163
class BookController extends Controller
161164
{
162165
public function search()
163-
{
166+
{
164167
Book::search('mustang')->paginate();
165168
// with a limit of items per page:
166169
Book::search('mustang')->paginate(5);
@@ -170,11 +173,39 @@ class BookController extends Controller
170173
}
171174
```
172175

176+
## Development Workflow
177+
178+
If you want to contribute, this section describes the steps to follow.
179+
180+
Thank you for your interest in a MeiliSearch tool! ♥️
181+
182+
### Install dependencies
183+
184+
```bash
185+
$ composer install
186+
```
187+
188+
### Tests and Linter
189+
190+
Each PR should pass the tests to be accepted.
191+
192+
```bash
193+
$ vendor/bin/phpunit --color tests/
194+
```
195+
196+
### Release
197+
198+
MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/).
199+
200+
Once the changes are merged into `master`, you must create a release (with this name `vX.X.X`) via the GitHub interface.<br>
201+
A webhook will be triggered and push the new package on [Packagist](https://packagist.org/packages/meilisearch/meilisearch-laravel-scout).
202+
173203
## Compatibility with MeiliSearch
174204

175205
This package works for MeiliSearch `>=v0.10`.
176206

177207
## Additional notes
208+
178209
You can use more advance function by reading the documentation of [MeiliSearch PHP Client](https://github.com/meilisearch/meilisearch-php)
179210

180211
This package is a custom engine of [Laravel Scout](https://laravel.com/docs/master/scout)

config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
return [
44
'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
55
'key' => env('MEILISEARCH_KEY', null)
6-
];
6+
];

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
<directory suffix=".php">./tests/</directory>
1616
</testsuite>
1717
</testsuites>
18-
</phpunit>
18+
</phpunit>

src/Console/IndexMeilisearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ public function handle()
3737
$this->error($exception->getMessage());
3838
}
3939
}
40-
}
40+
}

src/Engines/MeilisearchEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,4 @@ public function __call($method, $parameters)
201201
{
202202
return $this->meilisearch->$method(...$parameters);
203203
}
204-
}
204+
}

src/MeilisearchServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ public function boot()
2727

2828
resolve(EngineManager::class)->extend('meilisearch', fn() => new MeilisearchEngine(new Client(config('meilisearch.host'), config('meilisearch.key'))));
2929
}
30-
}
30+
}

tests/Fixtures/SearchableModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ public function scoutMetadata()
2323
{
2424
return [];
2525
}
26-
}
26+
}

0 commit comments

Comments
 (0)