cwa / sylius-example-plugin
Creatis Web Art 示例插件
0.1
2023-10-26 13:20 UTC
Requires
- php: ^8.0
- sylius/mailer-bundle: ^1.8 || ^2.0@beta
- sylius/sylius: ^1.12
- symfony/webpack-encore-bundle: ^1.15
Requires (Dev)
- behat/behat: ^3.6.1
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-debug-extension: ^2.0.0
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- phpspec/phpspec: ^7.2
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^1.8.1
- phpstan/phpstan-doctrine: 1.3.37
- phpstan/phpstan-strict-rules: ^1.3.0
- phpstan/phpstan-webmozart-assert: ^1.2.0
- phpunit/phpunit: ^9.5
- polishsymfonycommunity/symfony-mocker-container: ^1.0
- sylius-labs/coding-standard: ^4.2
- symfony/browser-kit: ^5.4 || ^6.0
- symfony/debug-bundle: ^5.4 || ^6.0
- symfony/dotenv: ^5.4 || ^6.0
- symfony/flex: ^2.2.2
- symfony/intl: ^5.4 || ^6.0
- symfony/web-profiler-bundle: ^5.4 || ^6.0
- vimeo/psalm: 5.9.0
Conflicts
- symfony/framework-bundle: 6.2.8
This package is auto-updated.
Last update: 2024-09-22 12:37:40 UTC
README
项目安装
composer create-project sylius/plugin-skeleton VendorNameSyliusPluginNamePlugin
命名更改
composer.json
添加
{ "name": "vendor-name/sylius-plugin-name-plugin", "description": "Description of plugin", "version": "VERSION", // ...
更改
// ... "autoload": { "psr-4": { "Acme\\SyliusExamplePlugin\\": "src/", "Tests\\Acme\\SyliusExamplePlugin\\": "tests/" } }, // ...🔽
// ... "autoload": { "psr-4": { "VendorName\\SyliusPluginNamePlugin\\": "src/", "Tests\\VendorName\\SyliusPluginNamePlugin\\": "tests/" } }, // ...
文件重命名
src/AcmeSyliusExamplePlugin ▶️ src/VendorNameSyliusPluginNamePlugin
src/DependencyInjection/AcmeSyliusExampleExtension ▶️ src/DependencyInjection/VendorNameSyliusPluginNameExtention
文件更改
-
src/DependencyInjection/Configuration.php
-
namespace
// ... namespace Acme\SyliusExamplePlugin; // ...
🔽// ... namespace VendorName\SyliusPluginNamePlugin; // ...
-
treeBuilder name
// ... public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('iron_man_sylius_product_on_demand_plugin'); // ...
🔽// ... public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('vendor_name_sylius_plugin_name_plugin'); // ...
-
-
src/DependencyInjection/VendorNameSyliusPluginNameExtension.php
-
namespace
// ... namespace Acme\SyliusExamplePlugin; // ...
🔽// ... namespace VendorName\SyliusPluginNamePlugin; // ...
-
classname
// ... final class AcmeSyliusExampleExtension extends AbstractResourceExtension implements PrependExtensionInterface // ...
🔽// ... final class VendorNameSyliusPluginNameExtension extends AbstractResourceExtension implements PrependExtensionInterface // ...
-
迁移目录
// ... protected function getMigrationsDirectory(): string { return '@AcmeSyliusExamplePlugin/migrations'; } // ...
🔽// ... protected function getMigrationsDirectory(): string { return '@VendorNameSyliusPluginNamePlugin/migrations'; } // ...
-
-
src/VendorNameSyliusPluginNamePlugin.php
-
namespace
// ... namespace Acme\SyliusExamplePlugin; // ...
🔽// ... namespace VendorName\SyliusPluginNamePlugin; // ...
-
classname
// ... final class AcmeSyliusExamplePlugin extends Bundle // ...
🔽// ... final class VendorNameSyliusPluginNamePlugin extends Bundle // ...
-
-
tests/Application/config/bundles.php
// ... Acme\SyliusExamplePlugin\AcmeSyliusExamplePlugin::class => ['all' => true], // ...
🔽// ... VendorName\SyliusPluginNamePlugin\VendorNameSyliusPluginNamePlugin::class => ['all' => true], // ...
-
tests/Application/bin/console
// ... use Tests\Acme\SyliusExamplePlugin\Application\Kernel; // ...
🔽// ... namespace Tests\Acme\SyliusExamplePlugin\Application; // ...
-
tests/Application/Kernel.php
// ... namespace Tests\VendorName\SyliusPluginNamePlugin\Application; // ...
🔽// ... use Tests\VendorName\SyliusPluginNamePlugin\Application\Kernel, // ...
要执行的命令
composer dump-autoload
(cd tests/Application && yarn install) (cd tests/Application && yarn build) (cd tests/Application && APP_ENV=test bin/console assets:install public)
如何测试插件
集成测试环境
导入配置文件
-Tests/Application/config/routes.yaml
//... pluginName_example: resource: "@VendorNameSyliusPluginNamePlugin/src/Resources/config/app/routing.yaml" //...
-Tests/Application/config/services.yaml
//... imports: - { resource : '@VendorNameSyliusPluginNamePlugin/src/Resources/config/app/services.yaml'} //...
启动网络服务器
(cd tests/Application && php symfony serve:start)
从外部项目
git 方法
//... "repositories": { "VendorNameSyliusPluginNamePlugin": { "type": "git", "url": "https://github.com/arhulCWA/tarteaufraise.git" } }, //... "require": { //... "vendor-name/sylius-plugin-name-plugin" : "dev-main" }, //...