Skeleton for starting Sylius plugins in a few minutes with docker.
- docker has the same versions as github actions (php 8.1, mysql 8.0, node 18.x)
- paths are correct and works without hasitate
- services.php for services.yaml
- installation updated and closed in Makefile commands
git clone [email protected]:hubertinio/SyliusExamplePlugin.git SyliusUnicornPlugin
Let's assume that the new plugin is Vendor\SyliusUnicornPlugin
- update name in the composer.json into
vendor\sylius-unicorn-plugin
- find and replace
Hubertinio\\SyliusExamplePlugin
intoVendor\\SyliusUnicornPlugin
- find and replace
Hubertinio\SyliusExamplePlugin
intoVendor\SyliusUnicornPlugin
- find and replace with case-sensitive
HubertinioSyliusExamplePlugin
intoVendorSyliusUnicornPlugin
- find and replace with case-sensitive
hubertiniosyliusexampleplugin
intovendorsyliusunicornplugin
- find and replace
hubertinio_sylius_example
intovendor_sylius_unicorn
- refactor class and file name
src/HubertinioSyliusExamplePlugin.php
intoVendorSyliusUnicornPlugin.php
- refactor class and file name
src/DependencyInjection/HubertinioSyliusExampleExtension.php
intosrc/DependencyInjection/VendorSyliusUnicornExtension.php
-
Execute
make build-containers
andmake start-containers
-
Initialize everything
make install
-
See your localhost
Don't tested yet.
For existing projects.
Set private repository.
"repositories": [
{
"type": "vcs",
"url": "[email protected]:vendor/SyliusUnicornPlugin.git"
}
],
Install.
composer require vendor/sylius-unicorn-plugin:1.12.x-dev
Insert into tests/Application/config/bundles.php
array that line:
Vendor\SyliusUnicornPlugin\VendorSyliusUnicornPlugin::class => ['all' => true],
Insert into tests/Application/config/routes.yaml
this content:
vendor_sylius_unicorn_plugin:
resource: "@VendorSyliusUnicornPlugin/config/routing.yml"
For a comprehensive guide on Sylius Plugins development please go to Sylius documentation, there you will find the Plugin Development Guide, that is full of examples.
-
PHPUnit
vendor/bin/phpunit
-
PHPSpec
vendor/bin/phpspec run
-
Behat (non-JS scenarios)
vendor/bin/behat --strict --tags="~@javascript"
-
Behat (JS scenarios)
-
Start Headless Chrome:
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
- Install SSL certificates (only once needed) and run test application's webserver on
127.0.0.1:8080
:
symfony server:ca:install APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
- Run Behat:
vendor/bin/behat --strict --tags="@javascript"
-
Static Analysis
-
Psalm
vendor/bin/psalm
-
PHPStan
vendor/bin/phpstan analyse -c phpstan.neon -l max src/
-
-
Coding Standard
vendor/bin/ecs check