|
8 | 8 | </a> |
9 | 9 | </p> |
10 | 10 |
|
11 | | -<h1 align="center">Plugin Skeleton</h1> |
| 11 | +<h1 align="center">Sylius Grid Assistant Plugin</h1> |
12 | 12 |
|
13 | | -<p align="center">Skeleton for starting Sylius plugins.</p> |
14 | | - |
15 | | -## Documentation |
16 | | - |
17 | | -For a comprehensive guide on Sylius Plugins development please go to Sylius documentation, |
18 | | -there you will find the <a href="https://docs.sylius.com/en/latest/plugin-development-guide/index.html">Plugin Development Guide</a>, that is full of examples. |
19 | | - |
20 | | -For more information about the **Test Application** included in the skeleton, please refer to the [Sylius documentation](https://docs.sylius.com/sylius-plugins/plugins-development-guide/testapplication). |
21 | | - |
22 | | -## Quickstart Installation |
23 | | - |
24 | | -Run `composer create-project sylius/plugin-skeleton ProjectName`. |
25 | | - |
26 | | -### Traditional |
27 | | - |
28 | | -1. From the plugin skeleton root directory, run the following commands: |
29 | | - |
30 | | - ```bash |
31 | | - (cd vendor/sylius/test-application && yarn install) |
32 | | - (cd vendor/sylius/test-application && yarn build) |
33 | | - vendor/bin/console assets:install |
34 | | - |
35 | | - vendor/bin/console doctrine:database:create |
36 | | - vendor/bin/console doctrine:migrations:migrate -n |
37 | | - # Optionally load data fixtures |
38 | | - vendor/bin/console sylius:fixtures:load -n |
39 | | - ``` |
40 | | - |
41 | | -To be able to set up a plugin's database, remember to configure your database credentials in `tests/TestApplication/.env` and `tests/TestApplication/.env.test`. |
42 | | -
|
43 | | -2. Run your local server: |
| 13 | +<p align="center"> |
| 14 | + <a href="https://github.com/Guiziweb/GuiziwebSyliusGridAssistantPlugin/actions"><img src="https://img.shields.io/github/actions/workflow/status/Guiziweb/GuiziwebSyliusGridAssistantPlugin/build.yaml?branch=main" alt="Build status"></a> |
| 15 | + <a href="https://packagist.org/packages/guiziweb/sylius-grid-assistant-plugin"><img src="https://img.shields.io/packagist/v/guiziweb/sylius-grid-assistant-plugin" alt="Latest version"></a> |
| 16 | + <a href="https://packagist.org/packages/guiziweb/sylius-grid-assistant-plugin"><img src="https://img.shields.io/packagist/php-v/guiziweb/sylius-grid-assistant-plugin" alt="PHP version"></a> |
| 17 | + <img src="https://img.shields.io/badge/phpunit-passing-success" alt="PHPUnit"> |
| 18 | + <img src="https://img.shields.io/badge/behat-passing-success" alt="Behat"> |
| 19 | + <img src="https://img.shields.io/badge/phpstan-level%20max-blue" alt="PHPStan max"> |
| 20 | + <img src="https://img.shields.io/badge/ecs-passing-success" alt="ECS"> |
| 21 | + <a href="https://packagist.org/packages/guiziweb/sylius-grid-assistant-plugin"><img src="https://img.shields.io/packagist/l/guiziweb/sylius-grid-assistant-plugin" alt="License"></a> |
| 22 | +</p> |
44 | 23 |
|
45 | | - ```bash |
46 | | - symfony server:ca:install |
47 | | - symfony server:start -d |
48 | | - ``` |
| 24 | +> **Natural language → filtered grid.** AI-powered filtering for Sylius admin grids. |
49 | 25 |
|
50 | | -3. Open your browser and navigate to `https://localhost:8000`. |
| 26 | +## How it works |
51 | 27 |
|
52 | | -### Docker |
| 28 | +In an admin grid (orders, products, customers...), the assistant adds a search bar at the top. Type your query in plain language: |
53 | 29 |
|
54 | | -1. Execute `make init` to initialize the container and install the dependencies. |
| 30 | +> *"orders over $100 from john.doe@gmail.com last month"* |
55 | 31 |
|
56 | | -2. Execute `make database-init` to create the database and run migrations. |
| 32 | +The plugin sends the query to a Large Language Model (OpenAI, Gemini, Anthropic, Mistral...), gets back structured filters and sorting (JSON Schema strict), and redirects to the same grid with the filters applied - exactly as if you had clicked them manually. |
57 | 33 |
|
58 | | -3. (Optional) Execute `make load-fixtures` to load the fixtures. |
| 34 | + |
59 | 35 |
|
60 | | -4. Your app is available at `http://localhost`. |
| 36 | +## Requirements |
61 | 37 |
|
62 | | -## Usage |
| 38 | +- PHP ^8.2 |
| 39 | +- Sylius ^2.0 |
| 40 | +- An AI provider account (OpenAI, Gemini, Anthropic, Mistral...) and its API key |
63 | 41 |
|
64 | | -### Running plugin tests |
| 42 | +## Quick install |
65 | 43 |
|
66 | | - - PHPUnit |
| 44 | +This plugin ships a [Symfony Flex recipe](https://github.com/Guiziweb/SyliusRecipes). With the Guiziweb recipe endpoint configured in your project (see linked repo), the install boils down to: |
67 | 45 |
|
68 | | - ```bash |
69 | | - vendor/bin/phpunit |
70 | | - ``` |
| 46 | +```bash |
| 47 | +composer require guiziweb/sylius-grid-assistant-plugin |
| 48 | +composer require symfony/ai-bundle symfony/ai-open-ai-platform # or another bridge |
| 49 | +``` |
71 | 50 |
|
72 | | - - Behat (non-JS scenarios) |
| 51 | +Then fill in your API key in `.env.local` and enable the grids you want. The Flex recipes (plugin + bridge) take care of the rest (bundle registration, config files, env var stub). |
73 | 52 |
|
74 | | - ```bash |
75 | | - vendor/bin/behat --strict --tags="~@javascript&&~@mink:chromedriver" |
76 | | - ``` |
| 53 | +Full step-by-step guide (with and without Flex): [installation](docs/installation.md). |
77 | 54 |
|
78 | | - - Behat (JS scenarios) |
79 | | - |
80 | | - 1. [Install Symfony CLI command](https://symfony.com/download). |
81 | | - |
82 | | - 2. Start Headless Chrome: |
83 | | - |
84 | | - ```bash |
85 | | - google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 |
86 | | - ``` |
87 | | - |
88 | | - 3. Install SSL certificates (only once needed) and run test application's webserver on `127.0.0.1:8080`: |
89 | | - |
90 | | - ```bash |
91 | | - symfony server:ca:install |
92 | | - APP_ENV=test symfony server:start --port=8080 --daemon |
93 | | - ``` |
94 | | - |
95 | | - 4. Run Behat: |
96 | | - |
97 | | - ```bash |
98 | | - vendor/bin/behat --strict --tags="@javascript,@mink:chromedriver" |
99 | | - ``` |
100 | | - |
101 | | - - Static Analysis |
102 | | - |
103 | | - - PHPStan |
104 | | - |
105 | | - ```bash |
106 | | - vendor/bin/phpstan analyse -c phpstan.neon -l max src/ |
107 | | - ``` |
| 55 | +## Documentation |
108 | 56 |
|
109 | | - - Coding Standard |
110 | | - |
111 | | - ```bash |
112 | | - vendor/bin/ecs check |
113 | | - ``` |
| 57 | +- [Installation](docs/installation.md) - full setup steps |
| 58 | +- [Usage](docs/usage.md) - admin guide with query examples |
| 59 | +- [Extending](docs/extending.md) - add custom filter types |
114 | 60 |
|
115 | | -### Opening Sylius with your plugin |
| 61 | +## License |
116 | 62 |
|
117 | | -- Using `test` environment: |
118 | | - |
119 | | - ```bash |
120 | | - APP_ENV=test vendor/bin/console vendor/bin/console sylius:fixtures:load -n |
121 | | - APP_ENV=test symfony server:start -d |
122 | | - ``` |
123 | | - |
124 | | -- Using `dev` environment: |
125 | | - |
126 | | - ```bash |
127 | | - vendor/bin/console vendor/bin/console sylius:fixtures:load -n |
128 | | - symfony server:start -d |
129 | | - ``` |
| 63 | +MIT - see [LICENSE](LICENSE). |
0 commit comments