Skip to content

Commit c8fa30d

Browse files
Add prototype for query translator implementation
1 parent be01e9b commit c8fa30d

File tree

12 files changed

+2577
-0
lines changed

12 files changed

+2577
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.gitattributes export-ignore
2+
.gitignore export-ignore
3+
composer.lock export-ignore
4+
/tests export-ignore
5+
phpunit.xml.dist export-ignore
6+
.php-cs-fixer.dist.php export-ignore
7+
phpstan.neon export-ignore
8+
rector.php export-ignore
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/vendor/
2+
/composer.phar
3+
/phpunit.xml
4+
/.phpunit.cache
5+
/tests/var
6+
/.php-cs-fixer.php
7+
/.php-cs-fixer.cache
8+
/phpstan.neon
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$phpCsConfig = require(dirname(__DIR__, 2) . '/.php-cs-fixer.dist.php');
6+
7+
$finder = (new PhpCsFixer\Finder())
8+
->in(__DIR__)
9+
->ignoreVCSIgnored(true);
10+
11+
$phpCsConfig->setFinder($finder);
12+
13+
return $phpCsConfig->setFinder($finder);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Alexander Schranz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<div align="center">
2+
<img alt="SEAL Logo with an abstract seal sitting on a telescope." src="https://avatars.githubusercontent.com/u/120221538?s=400&v=6" width="200" height="200">
3+
</div>
4+
5+
<div align="center">Logo created by <a href="https://cargocollective.com/meinewilma">Meine Wilma</a></div>
6+
7+
<h1 align="center">SEAL <br /> Memory Adapter</h1>
8+
9+
<br />
10+
<br />
11+
12+
The `MemoryAdapter` write the documents into an in-memory array.
13+
14+
> **Note**:
15+
> This is part of the `cmsig/search` project create issues in the [main repository](https://github.com/php-cmsig/search).
16+
17+
> **Note**:
18+
> This project is heavily under development and any feedback is greatly appreciated.
19+
20+
## Installation
21+
22+
Use [composer](https://getcomposer.org/) for install the package:
23+
24+
```bash
25+
composer require cmsig/seal cmsig/seal-memory-adapter
26+
```
27+
28+
## Usage
29+
30+
It is mostly used for testing purposes and as a reference implementation.
31+
32+
The following code shows how to create an Engine using this Adapter:
33+
34+
```php
35+
<?php
36+
37+
use CmsIg\Seal\Adapter\Memory\MemoryAdapter;
38+
use CmsIg\Seal\Engine;
39+
40+
$engine = new Engine(
41+
new MemoryAdapter(),
42+
$schema,
43+
);
44+
```
45+
46+
Via DSN for your favorite framework:
47+
48+
```env
49+
memory://
50+
```
51+
52+
## Authors
53+
54+
- [Alexander Schranz](https://github.com/alexander-schranz/)
55+
- [The Community Contributors](https://github.com/php-cmsig/search/graphs/contributors)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"name": "cmsig/seal-query-translator",
3+
"description": "Add support for string query translating for SEAL SearchBuilder.",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": [
7+
"cmsig",
8+
"seal",
9+
"seal-query-transator",
10+
"search-client"
11+
],
12+
"autoload": {
13+
"psr-4": {
14+
"CmsIg\\Seal\\QueryTranslator\\": "src"
15+
}
16+
},
17+
"autoload-dev": {
18+
"psr-4": {
19+
"CmsIg\\Seal\\QueryTranslator\\Tests\\": "tests"
20+
}
21+
},
22+
"authors": [
23+
{
24+
"name": "Alexander Schranz",
25+
"email": "alexander@sulu.io"
26+
}
27+
],
28+
"require": {
29+
"php": "^8.1",
30+
"cmsig/seal": "^0.6",
31+
"netgen/query-translator": "^1.1"
32+
},
33+
"require-dev": {
34+
"php-cs-fixer/shim": "^3.51",
35+
"phpstan/extension-installer": "^1.2",
36+
"phpstan/phpstan": "^1.10",
37+
"phpstan/phpstan-phpunit": "^1.3",
38+
"phpunit/phpunit": "^10.3",
39+
"rector/rector": "^1.0"
40+
},
41+
"scripts": {
42+
"test": [
43+
"Composer\\Config::disableProcessTimeout",
44+
"vendor/bin/phpunit"
45+
],
46+
"phpstan": "@php vendor/bin/phpstan analyze",
47+
"lint-rector": "@php vendor/bin/rector process --dry-run",
48+
"lint-php-cs": "@php vendor/bin/php-cs-fixer fix --verbose --diff --dry-run",
49+
"lint": [
50+
"@phpstan",
51+
"@lint-php-cs",
52+
"@lint-rector",
53+
"@lint-composer"
54+
],
55+
"lint-composer": "@composer validate --strict",
56+
"rector": "@php vendor/bin/rector process",
57+
"php-cs-fix": "@php vendor/bin/php-cs-fixer fix",
58+
"fix": [
59+
"@rector",
60+
"@php-cs-fix"
61+
]
62+
},
63+
"repositories": [
64+
{
65+
"type": "path",
66+
"url": "./../*",
67+
"options": {
68+
"symlink": true
69+
}
70+
}
71+
],
72+
"minimum-stability": "dev",
73+
"config": {
74+
"allow-plugins": {
75+
"phpstan/extension-installer": true
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)