Shopware 6 ๊ฐ๋ฐ
ํต์ฌ ์ํคํ ์ฒ
Shopware 6์ PHP/Symfony ํ๋ซํผ์ ๋๋ค. ์ฝ๋๋ฅผ ์์ฑํ๊ธฐ ์ ์ ๋์ ๊ณ์ธต์ ๋ช ํํ ํด์ผ ํฉ๋๋ค:
| ๊ณ์ธต | ๊ธฐ์ | ์์น |
|---|---|---|
| Core / PHP | PHP 8.2+, Symfony 7.4 (SW 6.7) / Symfony 7.0 (SW 6.6) | src/ โ ์๋น์ค, DAL, ์ด๋ฒคํธ |
| Storefront | Twig 3, SCSS, Vanilla JS, Vite dev server (6.7.11+) | src/Resources/views/storefront/ |
| Admin | Vue 3, Pinia, Meteor ์ปดํฌ๋ํธ (mt-*), Vite ๋น๋ | src/Resources/app/administration/ |
| App System | manifest.xml (6.7์์ schema 3.0), App Scripts | ์ธ๋ถ ์๋ฒ ๋๋ Twig ์คํฌ๋ฆฝํธ (PHP ๋ถํ์) |
Plugin vs App System: ์์ฒด ํธ์คํ ์ค์น ์ ์ง์ PHP/DB ์ ๊ทผ์ด ํ์ํ๋ฉด Plugin์ ์ฌ์ฉํ์ธ์. SaaS/๋ฉํฐํ ๋ํธ ํ๊ฒฝ์ด๊ฑฐ๋ Shopware Store๋ฅผ ๋์์ผ๋ก ํ ๋๋ App System์ ์ฌ์ฉํ์ธ์.
์ด๋ค ๋ฒ์ ์ธ๊ฐ์?
์ฝ๋๋ฅผ ์์ฑํ๊ธฐ ์ ์ ๋์ ๋ฒ์ ์ ๋ฌป๊ฑฐ๋ ์ ์ถํ์ธ์. ํ์ฌ ๋ผ์ธ์ 6.7.13.x์ด๋ฉฐ, 6.8์ 2027๋ ์ ๊ณํ๋์ด ์์ต๋๋ค. 6.7์ ํ๋ฌ๊ทธ์ธ ์งํฅ API๋ฅผ ๋ง์ด ๋ณ๊ฒฝํ์ผ๋ฏ๋ก 6.6์์ ์ฌ๋ฐ๋ฅธ ์ฝ๋๊ฐ 6.7์์๋ ์ข ์ข ํ๋ฆฝ๋๋ค:
| ์ฃผ์ | SW 6.6 | SW 6.7 |
|---|---|---|
| ๊ฒฐ์ ํธ๋ค๋ฌ | Synchronous/AsynchronousPaymentHandlerInterface | AbstractPaymentHandler |
| Admin ์ปดํฌ๋ํธ | sw-button, sw-card, sw-text-field | mt-button, mt-card, mt-text-field |
| Admin ์ํ | Vuex Shopware.State (deprecated) | Pinia Shopware.Store๋ง |
| Admin ๋น๋ | Webpack | Vite |
EntityExtension | getDefinitionClass() | ์ถ์ getEntityName() ์ถ๊ฐ |
| ํ๋ฌ๊ทธ์ธ ์ฌ์ฉ์ ์ ์ ์ํฐํฐ | entities.xml | ์ ๊ฑฐ๋จ, EntityDefinition ์ฌ์ฉ |
IdsCollection | Shopware\Core\Framework\Test\ | Shopware\Core\Test\Stub\Framework\ |
์ ์ฒด ๋ชฉ๋ก์ references/migration-6.7.md ์ ์์ต๋๋ค. ๋ฒ์ ์ ๋ชจ๋ฅผ ๊ฒฝ์ฐ, 6.7์ ๋์์ผ๋ก ํ๊ณ 6.6๊ณผ์ ์ฐจ์ด์ ์ ๋ช ์ํ์ธ์.
ํ๋ฌ๊ทธ์ธ ๊ตฌ์กฐ
PluginName/
โโโ composer.json
โโโ src/
โ โโโ PluginName.php # ๋ถํธ์คํธ๋ฉ ํด๋์ค
โ โโโ Resources/
โ โ โโโ config/
โ โ โ โโโ services.xml # Symfony DI ์ปจํ
์ด๋
โ โ โโโ views/
โ โ โ โโโ storefront/ # Twig ํ
ํ๋ฆฟ ์ค๋ฒ๋ผ์ด๋
โ โ โโโ app/
โ โ โโโ administration/ # Vue.js ๊ด๋ฆฌ์ ํ์ฅ
โ โโโ Migration/ # ๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ง์ด๊ทธ๋ ์ด์
โโโ tests/
ํ๋ฌ๊ทธ์ธ ๋ถํธ์คํธ๋ฉ
<?php declare(strict_types=1);
namespace VendorName\PluginName;
use Shopware\Core\Framework\Plugin;
class PluginName extends Plugin {}
๋ผ์ดํ์ฌ์ดํด ์์
(์: ๊ฒฐ์ ์๋จ ์์ฑ, ์ ๊ฑฐ ์ ํ
์ด๋ธ ๋๋กญ)์ด ํ์ํ ๋๋ง install(), activate(), deactivate(), uninstall()์ ํ์ฅํ์ธ์.
5๊ฐ์ง ํต์ฌ ์ํฌํ๋ก์ฐ
1. ์๋น์ค ๋ฑ๋ก (DI)
<!-- services.xml -->
<service id="VendorName\PluginName\Service\MyService">
<argument type="service" id="product.repository"/>
</service>
์ผ๋ฐ์ ์ธ ํ๊ทธ: kernel.event_subscriber, twig.extension, console.command, messenger.message_handler, shopware.entity.definition, shopware.entity.extension, shopware.rule.definition, shopware.payment.method.sync, shopware.payment.method.async, shopware.cms.element.
2. ์ด๋ฒคํธ ๋ฆฌ์ค๋ (Subscriber)
class ProductSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return ['product.written' => 'onProductWritten'];
}
public function onProductWritten(EntityWrittenEvent $event): void
{
foreach ($event->getWriteResults() as $result) {
$id = $result->getPrimaryKey();
}
}
}
3. DAL ์ฝ๊ธฐ ๋ฐ ์ฐ๊ธฐ
// ์ฝ๊ธฐ
$criteria = new Criteria();
$criteria->addFilter(new EqualsFilter('active', true));
$criteria->addAssociation('manufacturer');
$result = $this->productRepository->search($criteria, $context);
// ์ฐ๊ธฐ
$this->productRepository->upsert([
['id' => $id, 'name' => 'New Name'],
], $context);
4. Storefront ํ ํ๋ฆฟ ์ค๋ฒ๋ผ์ด๋
{# views/storefront/ ์๋์ ์๋ณธ ๊ฒฝ๋ก๋ฅผ ๋ฏธ๋ฌ๋ง #}
{% sw_extends '@Storefront/storefront/page/product-detail/index.html.twig' %}
{% block page_product_detail_content %}
<div class="my-banner">์ฌ์ฉ์ ์ ์ ์ฝํ
์ธ </div>
{{ parent() }}
{% endblock %}
5. ์๋น์ค ๋ฐ์ฝ๋ ์ดํธ
<service id="VendorName\PluginName\Decorator\MyDecorator"
decorates="original.service.id">
<argument type="service"
id="VendorName\PluginName\Decorator\MyDecorator.inner"/>
</service>
Karpathy ์์น โ ์ฝ๋ฉ ์ ๋ช ํํ ํ๊ธฐ
์ฝ๋๋ฅผ ์์ฑํ๊ธฐ ์ ์ ๋ค์ ๊ฐ์ ์ ํ๋ฉดํํ์ธ์:
- ๋ฒ์ ? SW 6.5 vs 6.6 (API ๋ฐ Vue ์ปดํฌ๋ํธ ์ฐจ์ด ์กด์ฌ)
- Plugin ๋๋ App System? Plugin = PHP ์๋ฒ; App = manifest.xml + ์ธ๋ถ/์๋ฒ ์์
- ๊ณ์ธต? PHP/Core, Storefront, Admin, ๋๋ ํค๋๋ฆฌ์ค/Store API
- ์ฝ๊ธฐ ๋๋ ์ฐ๊ธฐ? Repository
search()vsupsert()/create()/update() - ์ํฐํฐ ๋๋ ํ์ฅ? ์ ํ ์ด๋ธ vs ๊ธฐ์กด ์ํฐํฐ ํ์ฅ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ์ต์ ์ฝ๋๋ง ์์ฑํ์ธ์. Shopware์ DI ๋ฐ ์ด๋ฒคํธ ์์คํ ์ด ๋๋ถ๋ถ์ ๋ณต์ก์ฑ์ ์ฒ๋ฆฌํฉ๋๋ค.
DAL ๋น ๋ฅธ ์ฐธ์กฐ
// Criteria
$criteria->addFilter(new EqualsFilter('active', true));
$criteria->addFilter(new ContainsFilter('name', 'shirt'));
$criteria->addFilter(new RangeFilter('price', [RangeFilter::GTE => 10]));
$criteria->addAssociation('manufacturer');
$criteria->addSorting(new FieldSorting('name', FieldSorting::ASCENDING));
$criteria->setLimit(25)->setOffset(0);
// Context
$context = Context::createDefaultContext(); // ์์คํ
// ๋๋ ๋ผ์ฐํธ/์ด๋ฒคํธ์์ SalesChannelContext ์ฃผ์
// ID๋ง (๋ ๋น ๋ฆ, ์ํ ์์)
$ids = $this->repo->searchIds($criteria, $context)->getIds();
Admin Vue.js ๋น ๋ฅธ ์ฐธ์กฐ
// ๋ชจ๋ ๋ฑ๋ก
Shopware.Module.register('my-module', {
type: 'plugin',
routes: { index: { component: 'my-module-index', path: 'index' } },
navigation: [{ label: 'my-module.title', path: 'my.module.index', icon: 'default-shopping-paper-bag' }],
});
// ๊ธฐ์กด ์ปดํฌ๋ํธ ์ค๋ฒ๋ผ์ด๋
Shopware.Component.override('sw-product-detail', {
methods: {
async saveProduct() {
await this.$super('saveProduct'); // ์๋ณธ ํธ์ถ
},
},
});
CLI ๋ช ๋ น์ด
bin/console plugin:install --activate PluginName
bin/console database:migrate --all PluginName
bin/console cache:clear
bin/console plugin:refresh
bin/build-administration.sh
bin/build-storefront.sh
bin/console theme:compile
php vendor/bin/phpunit --testsuite=unit
vendor/bin/phpstan analyse src --level=8
์ถ๊ฐ ๋ฆฌ์์ค
์ฐธ์กฐ ํ์ผ
ํน์ ์์ญ ์์ ์ ๋ค์ ํ์ผ์ ๋ก๋ํ์ธ์:
- references/dal.md โ DAL: EntityDefinition, Criteria, Aggregations, custom fields, Entity Extensions (ํต์ฌ ์ํฐํฐ ํ์ฅ)
- references/admin.md โ Admin: Vue ๋ชจ๋, ์ปดํฌ๋ํธ, ์ค๋ฒ๋ผ์ด๋, ๋ช ๋ช ๊ท์น, ACL ๊ถํ, ํํฐ/์ธ๋ผ์ธ ํธ์ง, ๊ฒ์ ๊ตฌ์ฑ
- references/storefront.md โ Storefront: Twig ์์, SCSS/ํ ๋ง ๋ณ์, JavaScript ํ๋ฌ๊ทธ์ธ, ์ปจํธ๋กค๋ฌ
- references/themes.md โ ํ ๋ง: theme.json (๊ตฌ์ฑ ํ๋, ์์, ๊ธ๊ผด, ๋ฏธ๋์ด), SCSS Bootstrap ์ค๋ฒ๋ผ์ด๋, ํ ๋ง ์์, ThemeInterface, CLI ๋ช ๋ น์ด
- references/cart.md โ ์นดํธ: CartDataCollector, CartProcessor, CartValidator + ์ฌ์ฉ์ ์ง์ ์ค๋ฅ, ํ ์ธ ๋ผ์ธ ์์ดํ , ๊ฐ๊ฒฉ ์กฐ์, Tax Provider
- references/seo-mail.md โ SEO: SeoUrlRoute, ์ฌ์ดํธ๋งต URL ์ ๊ณต์; Mail: ์ฌ์ฉ์ ์ ์ ๋ฉ์ผ ํ ํ๋ฆฟ (๋ง์ด๊ทธ๋ ์ด์ + ์ ์ก); ๋ฌธ์ (์ฌ์ฉ์ ์ ์ PDF ์ ํ); ์ฃผ๋ฌธ ์ํ ๋จธ์ (์ ํ, ์ด๋ฒคํธ)
- references/plugin-structure.md โ ์ ์ฒด ํ๋ฌ๊ทธ์ธ ํด๋ถ: services.xml, ๋ผ์ดํ์ฌ์ดํด ํ , composer.json, ์ฝ์ ๋ช ๋ น์ด, ์์ฝ๋ ์์
- references/api.md โ Admin API ๋ฐ Store API: CRUD, ๋ฒํฌ, ํํฐ; ์ปจํ ์คํธ ํ ํฐ ๋ผ์ดํ์ฌ์ดํด, Cart/Checkout/Account Store API, TypeScript ํด๋ผ์ด์ธํธ ํจํด
- references/testing.md โ PHPUnit ์ ๋/ํตํฉ, StaticEntityRepository, ProductBuilder, Jest, Cypress, assertSame vs assertEquals
- references/app-system.md โ App System: manifest.xml, ์นํ HMAC ๊ฒ์ฆ, ๋ฑ๋ก ํธ๋์ ฐ์ดํฌ, App Scripts (Twig ๊ธฐ๋ฐ, ์๋ฒ ๋ถํ์)
- references/security.md โ ๋ณด์: ๋ผ์ฐํธ ๋ฒ์, CSRF ๋ณดํธ, ์ ๋ ฅ ๊ฒ์ฆ, ๊ณ ๊ฐ๋ณ ๊ถํ ๋ถ์ฌ, SQL ์ธ์ ์ ๋ฐฉ์ง
- references/integrations.md โ ํตํฉ: ๊ฒฐ์ ํธ๋ค๋ฌ (
AbstractPaymentHandler), ๋ฐฐ์ก ๋น์ฉ (์นดํธ ํ๋ก์ธ์, ๊ณ์ฐ๊ธฐ ํ๊ทธ ์๋), CMS ์์, Rule Builder ์กฐ๊ฑด, Flow Builder ์ด๋ฒคํธ - references/performance.md โ ์ฑ๋ฅ: HTTP ์บ์ (ํ๊ทธ, ๋ฌดํจํ), ๋ฉ์์ง ํ (๋น๋๊ธฐ ์ฒ๋ฆฌ), Elasticsearch/OpenSearch, ๊ฐ์ฒด ์บ์
- references/devops.md โ DevOps: ๊ตฌ์กฐํ๋ ๋ก๊น , PHPStan, php-cs-fixer, CI/CD, ๋ฐฐํฌ, ๋๋ฒ๊น , ๋ฏธ๋์ด ์ฒ๋ฆฌ, ์ ๊ทธ๋ ์ด๋ ์์ ์ฑ
- references/migration-6.7.md โ 6.6์์ 6.7 ๋ง์ด๊ทธ๋ ์ด์ : Core/DAL, Admin, Storefront, ์บ์, API, ํธ์คํ ์ ๋ฐ์ ์ฃผ์ ๋ณ๊ฒฝ ์ฌํญ ๋ฐ 6.7.x์์ ์ถ๊ฐ๋ ์ฌํญ (Vite dev server, Twig UX ์ปดํฌ๋ํธ, MCP ์๋ฒ)
- references/advanced.md โ ๊ณ ๊ธ: PHP Attribute ์ํฐํฐ (SW 6.6.3+), Flysystem (๊ณต๊ฐ/๋น๊ณต๊ฐ ํ์ผ ์ ์ฅ์), Redis (์บ์/ํ), Rate Limiter (์ปดํ์ผ๋ฌ ํจ์ค + RateLimiter ์๋น์ค), Data Indexer, ํ๋ ์์ (๋ณํ), ์ธ์ฑ ๊ตฌ๋งค
์์
examples/ ๋๋ ํ ๋ฆฌ์ ์๋ํ๋ ์ฝ๋ ์์ :
- examples/custom-entity/ โ ์คํ ๊ฐ๋ฅํ ํ๋ฌ๊ทธ์ธ: Definition, Entity, Collection, Migration, versioned FK to
product, ์ ๊ฑฐ ์ ์ ๋ฆฌ - examples/storefront-subscriber/ โ ์คํ ๊ฐ๋ฅํ ํ๋ฌ๊ทธ์ธ: ํ์ด์ง ๊ตฌ๋ ์, ํ๋งค ์ฑ๋ ๋ฆฌํฌ์งํ ๋ฆฌ, Twig ์ค๋ฒ๋ผ์ด๋, ์ค๋ํซ