SlideShare una empresa de Scribd logo
1 de 71
Descargar para leer sin conexión
Immersion in the Sylius
Paweł Jędrzejewski
Who am I?
Paweł Jędrzejewski
Huge beliver in Open Source
Symfony & BDD evangelist
Creator of Sylius
Working for Opensoft on
ŁÓDŹ, POLAND
?
THE PROBLEM
PHP has changed
This change created the market for a new e-commerce solution
among developers
With the flexibility of modern frameworks and the new way of
collaboration we can build something interesting for the business
Sylius reflects this evolution
Immersion in the Sylius
WHAT IS SYLIUS
A short history
Open sourced in 2011 as a set of bundles
Main application in development for ~9 months
Already used in production by developers and companies
FLEXIBILITY QUALITY PEOPLE
Immersion in the Sylius
Immersion in the Sylius
FLEXIBILITY QUALITY PEOPLE
QUALITY
Behat and phpspec, perfect combination
Most of new features start with an RFC issue
Discussion about the idea and eventual implementation
Behat features
Implementation
Immersion in the Sylius
Immersion in the Sylius
Immersion in the Sylius
Immersion in the Sylius
FLEXIBILITY QUALITY PEOPLE
BUNDLES vs. MAIN APPLICATION
Set of 19 decoupled and
independent bundles

Standard webshop
experience

Can be used to create a
custom platform

Highly customizable

Integrate e-commerce into
existing application

Easy to understand for
every Symfony2 developer
Sylius Bundles
What they can do for you?

EVERY SINGLE SYLIUS FEATURE AVAILABLE FOR YOUR PROJECt
Simpler CRUD for symfony
SyliusResourceBundle
Removing tons of duplicated code in controllers for basic CRUD
actions.
Removing the manager and manipulator classes, relying on
Doctrine instead.
Removing the "frontend" and "backend" controllers.
Supporting different persistence layers.
Make the controllers format agnostic. (API)
ADD YOUR RESOURCE
sylius_resource:
resources:
acme.user:
driver: doctrine/orm
templates: AcmeShopBundle:User
classes:
model: AcmeShopBundleEntityUser
repository: AcmeShopBundleEntityUserRepository
controller: AcmeShopBundleControllerUserController
acme.controller.user
showAction
indexAction
createAction
updateAction
deleteAction
acme_user_show:
pattern: /users/{id}
methods: [GET]
defaults:
_controller: acme.controller.user:showAction
acme_profile_show:
pattern: /profile/{username}
methods: [GET]
defaults:
_controller: acme.controller.user:showAction
_sylius:
template: AcmeShopBundle:Profile:show.html.twig
criteria: { username: $username, enabled: true }
acme_profile_show:
pattern: /profile/{username}
methods: [GET]
defaults:
_controller: acme.controller.user:showAction
_sylius:
template: AcmeShopBundle:Profile:show.html.twig
method: findOneForProfilePage
arguments: [$username]
acme_user_disabled_index:
pattern: /users/disabled
methods: [GET]
defaults:
_controller: acme.controller.user:indexAction
_sylius:
template: AcmeShopBundle:User:disabled.html.twig
criteria: { enabled: false }
acme_user_recently_registered:
pattern: /users/recently-registered
methods: [GET]
defaults:
_controller: acme.controller.user:indexAction
_sylius:
template: AcmeShopBundle:User:recentlyRegistered.html.twig
criteria: { enabled: true }
sorting: { createdAt: desc }
paginate: false
limit: 5
acme_user_update_addresses:
pattern: /users/{id}/update-addresses
methods: [GET]
defaults:
_controller: acme.controller.user:updateAction
_sylius:
template: AcmeShopBundle:User:updateAddresses.html.twig
form: acme_user_addresses
redirect:
route: acme_user_index
Docs.sylius.org
CONFIGURATION
sylius_taxation:
driver: doctrine/orm
classes:
tax_rate:
model: AcmeShopBundleEntityTaxRate
controller: AcmeShopBundleControllerTaxRateController
repository: AcmeShopBundleEntityTaxRateRepository
form: AcmeShopBundleFormTypeTaxRateType
validation_groups:
tax_rate: [sylius, acme]
USING CUSTOM MODELS and FORMS
Every model class can be overridden
All repositories, managers and forms are
updated automatically
Form class can be customized
OVERRIDING CONTROLLERS
All models use default or slightly customized
CRUD controller
Add your own methods
YOUR OWN REPOSITORY
Sylius repositories extend native Doctrine
implementations
Override the repositories through configuration
Repositories are services
CHANGE THE RULES, VALIDATION
All Sylius models ship with their own validation
mapping under group „sylius”
You can easily override it with your own rules
Consistent translation messages
DOCTRINE RTEL, DYNAMIC RELATIONS
We're using interfaces instead of
implementation to define the relations
When you override the model class, all relations
get updated automatically
Defaults are turned into entities if you don't
provide your own class
WE LOVE EVENTS, YOU SHOULD TOO
The default controller triggers multiple useful
events during CRUD actions

sylius.product.pre_create
sylius.product.post_create
PRODUCTS
SyliusProductBundle
Immersion in the Sylius
ORDERS AND CART
SyliusOrderBundle + SyliusCartBundle
Generic Order model with support of Adjustments
Cart bundle provides actions and services for customer to
interact with the Order entity
The order/cart items can be easily customized to handle
different options
Immersion in the Sylius
COUNTRIES, ZONES AND ADDRESSES
SyliusAddressingBundle
Provides a very basic Address model
Countries and their Provinces management
Zones system with a ZoneMatcher service
Useful for taxation and shipping zones
$billingAddress = $order->getBillingAddress();
$zone = $this->zoneMatcher->match($billingAddress);
$address = $location->getAddress();
$zones = $this->zoneMatcher->matchAll($address);
TAKE CARE OF YOUR INVENTORY
SyliusInventoryBundle
Built around 1 interface you need to implement
Tracks every single inventory unit
Based on events
Items available on demand
Backorders
HATE IT OR LOVE IT, TAXATION
SyliusTaxationBundle
TaxableInterface = heart of the bundle
Multiple tax categories and rates support
Customizable tax calculators
Tax included in price
MERCHANDISE NEEDS TO BE SHIPPED
SyliusShippingBundle
Integrate through one interface
Manage Shipments and Shipping Methods
Custom shipping rules
Flexible calculators system
class PerItemRateCalculator extends Calculator
{
public function calculate(ShippingSubjectInterface $subject, array $configuration)
{
return $configuration['amount'] * $subject->getShippingItemCount();
}
public function getConfigurationFormType()
{
return 'sylius_shipping_calculator_per_item_rate_configuration';
}
public function setConfiguration(OptionsResolverInterface $resolver)
{
$resolver
->setRequired(array( 'amount'))
->setAllowedTypes(array('amount' => array('numeric')))
;
}
}
Immersion in the Sylius
CATEGORIZE ALL THIS STUFF, NOW
SyliusTaxonomiesBundle
Classify any Model using different Taxonomies
Flexible forms
Based on DoctrineExtensions
Immersion in the Sylius
JUST FEW STEPS MORE
SyliusFlowBundle
Useful for anything which takes more than 1
action to complete
Checkouts, installation wizards, complex actions
Used by OroCRM and Akeneo PIM for installers
PROCESS SCENARIO
<?php
class CheckoutProcessScenario implements ProcessScenarioInterface
{
public function build(ProcessBuilderInterface $builder)
{
$builder
->add('security', 'sylius_checkout_security')
->add('addressing', 'sylius_checkout_addressing')
->add('shipping', 'sylius_checkout_shipping')
->add('payment', 'sylius_checkout_payment')
->add('finalize', 'sylius_checkout_finalize')
->add('purchase', 'sylius_checkout_purchase')
;
}
}
PAYUM INTEGRATION
SyliusPayumBundle NEW!
Integrates Payum library into Sylius checkout
Replaceable by other bundles in future
PayPal Express Checkout and Stripe support
Omnipay usage through a bridge
Make your app configurable, EASILY
SyliusSettingsBundle
You can define settings schema and the form
User edits the settings through UI
You get the access via services and Twig
Settings schema
class GeneralSettingsSchema implements SchemaInterface
{
public function buildSettings(SettingsBuilderInterface $builder)
{
$builder
->setDefaults(array(
'meta_keywords'

=> 'symfony, sylius, ecommerce, webshop, shopping cart',

'meta_description' => 'Sylius is modern ecommerce solution for PHP.',
))
->setAllowedTypes(array(
'meta_keywords'

=> array('string'),

'meta_description' => array('string'),
))
;
}
EDITING VIA FORM
public function buildForm(FormBuilderInterface $builder)
{
$builder
->add('meta_keywords', 'text', array(
'constraints' => array(new NotBlank())
))
->add('meta_description', 'textarea', array(
'constraints' => array(new NotBlank())
))
;
}
Immersion in the Sylius
PROMOTIONS ARE NICE
SyliusPromotionsBundle
Can be integrated with any Model
Very flexible Actions and Rules system
Support for promotion coupons
PROMOTION STRUCTURE
SUPER AWESOME PROMOTION
ACTION

RULE

ACTION

RULE

ACTION
CUSTOM RULES
interface RuleCheckerInterface
{
/**
* @param PromotionSubjectInterface $subject
* @param array

$configuration

*
* @return Boolean
*/
public function isEligible(PromotionSubjectInterface $subject, array $configuration);
/**
* @return string
*/
public function getConfigurationFormType();
}
YOUR OWN ACTIONS
class AddPackageAction implements PromotionActionInterface
{
public function execute(PromotionSubjectInterface $subject, array $configuration)
{
$package = $this->findPackage($configuration);
$item = $this->cartItemRepository->createNew();
$item->setQuantity(1);
$item->setUnitPrice(isset($configuration['price']) ? $configuration['price'] : $package->getGrossPrice());
$item->setPackage($package);
$subject->addItem($item);
}
public function getConfigurationFormType()
{
return 'xyz_promotion_action_add_package_configuration';
}
}
Immersion in the Sylius
Sylius Application
How to bootstrap Symfony2 shop in minutes? (soon)

Bringing smile back to developer's faces
INSTALLATION

$ composer create-project sylius/sylius -s dev path/to/install
$ cd path/to/install
$ app/console sylius:install

$ composer create-project sylius/sylius-standard -s dev path/to/install
$ cd path/to/install
$ app/console sylius:install
ONE CORE TO RULE THEM ALL
SyliusCoreBundle
Integrates all the bundles together
Standard webshop application
Contains all the models and services
THE WEB INTERFACE
SyliusWebBundle
Provides the default web interface for Sylius
Contains all the templates and menu builders
Splitted into Frontend & Backend parts
Immersion in the Sylius
THE BACKEND
public function forwardAction(ProcessContextInterface $context)
{
$request = $this->getRequest();
$order = $this->getCurrentCart();
$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_INITIALIZE, $order);
$form = $this->createCheckoutAddressingForm($order);
if ($request->isMethod('POST') && $form->bind($request)->isValid()) {
$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_PRE_COMPLETE, $order);
$this->getManager()->persist($order);
$this->getManager()->flush();
$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_COMPLETE, $order);
return $this->complete();
}
return $this->renderStep($context, $order, $form);
}
Immersion in the Sylius
TO DO
Documentation, documentation, documentation
New default store look
Rework translations and integrate with CrowdIn
Polish the checkout process
Integrate BazingaHateoasBundle for API
Integrate Symfony CMF and Create.js
COMING SOON...
Pull Requests
Customer groups
Subscriptions support
Product reviews
Symfony CMF integration (editable blocks and pages)
Facebook/Amazon and so on...
Immersion in the Sylius
Www.sylius.org
Github.com/sylius
@pjedrzejewski

THANK YOU
Questions?

Más contenido relacionado

Similar a Immersion in the Sylius

Modernize Siebel CRM with Open UI
Modernize Siebel CRM with Open UIModernize Siebel CRM with Open UI
Modernize Siebel CRM with Open UIPerficient, Inc.
 
Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...
Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...
Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...RootedCON
 
Navigating Pains When Moving Your Training Solution to the Public Cloud
Navigating Pains When Moving Your Training Solution to the Public CloudNavigating Pains When Moving Your Training Solution to the Public Cloud
Navigating Pains When Moving Your Training Solution to the Public CloudCloudShare
 
Melbourne Virtual MuleSoft Meetup December 2022
Melbourne Virtual MuleSoft Meetup December 2022Melbourne Virtual MuleSoft Meetup December 2022
Melbourne Virtual MuleSoft Meetup December 2022Daniel Soffner
 
Deveo
DeveoDeveo
DeveoDeveo
 
Contino aws summit - enterprise dev ops presentation - final bs
Contino   aws summit - enterprise dev ops presentation -  final bsContino   aws summit - enterprise dev ops presentation -  final bs
Contino aws summit - enterprise dev ops presentation - final bsBen Saunders
 
What's new in Nintex - Latest feature releases and what is coming ...
What's new in Nintex - Latest feature releases and what is coming ...What's new in Nintex - Latest feature releases and what is coming ...
What's new in Nintex - Latest feature releases and what is coming ...Nintex User Group UK
 
Discover Salesforce Commerce Cloud and Vlocity Integration Patterns
Discover Salesforce Commerce Cloud and Vlocity Integration PatternsDiscover Salesforce Commerce Cloud and Vlocity Integration Patterns
Discover Salesforce Commerce Cloud and Vlocity Integration PatternsEva Mave Ng
 
Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...
Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...
Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...mfrancis
 
Jelastic Turnkey Cloud PaaS for Hosting Business
Jelastic Turnkey Cloud PaaS for Hosting BusinessJelastic Turnkey Cloud PaaS for Hosting Business
Jelastic Turnkey Cloud PaaS for Hosting BusinessJelastic Multi-Cloud PaaS
 
How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...
How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...
How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...Guilhaume Garcia
 
Red hat forum 2019 - Modern Organization Cookbook
Red hat forum 2019 - Modern Organization CookbookRed hat forum 2019 - Modern Organization Cookbook
Red hat forum 2019 - Modern Organization CookbookStefan van Oirschot
 
Achieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
Achieving Cost and Resource Efficiency through Docker, OpenShift and KubernetesAchieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
Achieving Cost and Resource Efficiency through Docker, OpenShift and KubernetesDean Delamont
 
Enterprise software needs a PaaS
Enterprise software needs a PaaSEnterprise software needs a PaaS
Enterprise software needs a PaaShmalphettes
 
Intalio create and cloudfoudry - short
Intalio create and cloudfoudry - shortIntalio create and cloudfoudry - short
Intalio create and cloudfoudry - shorthmalphettes
 
Moderniser le legacy JEE avec les containers et les microservices: patterns a...
Moderniser le legacy JEE avec les containers et les microservices: patterns a...Moderniser le legacy JEE avec les containers et les microservices: patterns a...
Moderniser le legacy JEE avec les containers et les microservices: patterns a...VMware Tanzu
 
Salesforce cicd integration a quick guide
Salesforce cicd integration a quick guideSalesforce cicd integration a quick guide
Salesforce cicd integration a quick guideKaty Slemon
 
Runtime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptx
Runtime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptxRuntime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptx
Runtime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptxSandeep Deshmukh
 

Similar a Immersion in the Sylius (20)

Modernize Siebel CRM with Open UI
Modernize Siebel CRM with Open UIModernize Siebel CRM with Open UI
Modernize Siebel CRM with Open UI
 
Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...
Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...
Juan Francisco Losa - Nuevos enfoques de seguridad en un Banco Digital [roote...
 
DevOps Offerings at WhiteHedge
DevOps Offerings at WhiteHedgeDevOps Offerings at WhiteHedge
DevOps Offerings at WhiteHedge
 
Navigating Pains When Moving Your Training Solution to the Public Cloud
Navigating Pains When Moving Your Training Solution to the Public CloudNavigating Pains When Moving Your Training Solution to the Public Cloud
Navigating Pains When Moving Your Training Solution to the Public Cloud
 
Melbourne Virtual MuleSoft Meetup December 2022
Melbourne Virtual MuleSoft Meetup December 2022Melbourne Virtual MuleSoft Meetup December 2022
Melbourne Virtual MuleSoft Meetup December 2022
 
Deveo
DeveoDeveo
Deveo
 
Contino aws summit - enterprise dev ops presentation - final bs
Contino   aws summit - enterprise dev ops presentation -  final bsContino   aws summit - enterprise dev ops presentation -  final bs
Contino aws summit - enterprise dev ops presentation - final bs
 
What's new in Nintex - Latest feature releases and what is coming ...
What's new in Nintex - Latest feature releases and what is coming ...What's new in Nintex - Latest feature releases and what is coming ...
What's new in Nintex - Latest feature releases and what is coming ...
 
Jelastic Turnkey Cloud PaaS for Developers
Jelastic Turnkey Cloud PaaS for DevelopersJelastic Turnkey Cloud PaaS for Developers
Jelastic Turnkey Cloud PaaS for Developers
 
Discover Salesforce Commerce Cloud and Vlocity Integration Patterns
Discover Salesforce Commerce Cloud and Vlocity Integration PatternsDiscover Salesforce Commerce Cloud and Vlocity Integration Patterns
Discover Salesforce Commerce Cloud and Vlocity Integration Patterns
 
Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...
Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...
Build bundles in the cloud - How Cloudyle PaaS+ helps creating OSGi applicati...
 
Jelastic Turnkey Cloud PaaS for Hosting Business
Jelastic Turnkey Cloud PaaS for Hosting BusinessJelastic Turnkey Cloud PaaS for Hosting Business
Jelastic Turnkey Cloud PaaS for Hosting Business
 
How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...
How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...
How to Quickly Implement a Private Cloud with IBM SmartCloud Entry 3.2, the I...
 
Red hat forum 2019 - Modern Organization Cookbook
Red hat forum 2019 - Modern Organization CookbookRed hat forum 2019 - Modern Organization Cookbook
Red hat forum 2019 - Modern Organization Cookbook
 
Achieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
Achieving Cost and Resource Efficiency through Docker, OpenShift and KubernetesAchieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
Achieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
 
Enterprise software needs a PaaS
Enterprise software needs a PaaSEnterprise software needs a PaaS
Enterprise software needs a PaaS
 
Intalio create and cloudfoudry - short
Intalio create and cloudfoudry - shortIntalio create and cloudfoudry - short
Intalio create and cloudfoudry - short
 
Moderniser le legacy JEE avec les containers et les microservices: patterns a...
Moderniser le legacy JEE avec les containers et les microservices: patterns a...Moderniser le legacy JEE avec les containers et les microservices: patterns a...
Moderniser le legacy JEE avec les containers et les microservices: patterns a...
 
Salesforce cicd integration a quick guide
Salesforce cicd integration a quick guideSalesforce cicd integration a quick guide
Salesforce cicd integration a quick guide
 
Runtime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptx
Runtime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptxRuntime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptx
Runtime Fabric on OpenShift _--_ MuleSoft Meetup Deck.pptx
 

Último

Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 

Último (20)

20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 

Immersion in the Sylius

  • 1. Immersion in the Sylius Paweł Jędrzejewski
  • 2. Who am I? Paweł Jędrzejewski Huge beliver in Open Source Symfony & BDD evangelist Creator of Sylius Working for Opensoft on
  • 4. ?
  • 5. THE PROBLEM PHP has changed This change created the market for a new e-commerce solution among developers With the flexibility of modern frameworks and the new way of collaboration we can build something interesting for the business Sylius reflects this evolution
  • 7. WHAT IS SYLIUS A short history Open sourced in 2011 as a set of bundles Main application in development for ~9 months Already used in production by developers and companies
  • 12. QUALITY Behat and phpspec, perfect combination Most of new features start with an RFC issue Discussion about the idea and eventual implementation Behat features Implementation
  • 18. BUNDLES vs. MAIN APPLICATION Set of 19 decoupled and independent bundles Standard webshop experience Can be used to create a custom platform Highly customizable Integrate e-commerce into existing application Easy to understand for every Symfony2 developer
  • 19. Sylius Bundles What they can do for you? EVERY SINGLE SYLIUS FEATURE AVAILABLE FOR YOUR PROJECt
  • 20. Simpler CRUD for symfony SyliusResourceBundle Removing tons of duplicated code in controllers for basic CRUD actions. Removing the manager and manipulator classes, relying on Doctrine instead. Removing the "frontend" and "backend" controllers. Supporting different persistence layers. Make the controllers format agnostic. (API)
  • 21. ADD YOUR RESOURCE sylius_resource: resources: acme.user: driver: doctrine/orm templates: AcmeShopBundle:User classes: model: AcmeShopBundleEntityUser repository: AcmeShopBundleEntityUserRepository controller: AcmeShopBundleControllerUserController
  • 23. acme_user_show: pattern: /users/{id} methods: [GET] defaults: _controller: acme.controller.user:showAction acme_profile_show: pattern: /profile/{username} methods: [GET] defaults: _controller: acme.controller.user:showAction _sylius: template: AcmeShopBundle:Profile:show.html.twig criteria: { username: $username, enabled: true }
  • 24. acme_profile_show: pattern: /profile/{username} methods: [GET] defaults: _controller: acme.controller.user:showAction _sylius: template: AcmeShopBundle:Profile:show.html.twig method: findOneForProfilePage arguments: [$username] acme_user_disabled_index: pattern: /users/disabled methods: [GET] defaults: _controller: acme.controller.user:indexAction _sylius: template: AcmeShopBundle:User:disabled.html.twig criteria: { enabled: false }
  • 25. acme_user_recently_registered: pattern: /users/recently-registered methods: [GET] defaults: _controller: acme.controller.user:indexAction _sylius: template: AcmeShopBundle:User:recentlyRegistered.html.twig criteria: { enabled: true } sorting: { createdAt: desc } paginate: false limit: 5
  • 26. acme_user_update_addresses: pattern: /users/{id}/update-addresses methods: [GET] defaults: _controller: acme.controller.user:updateAction _sylius: template: AcmeShopBundle:User:updateAddresses.html.twig form: acme_user_addresses redirect: route: acme_user_index
  • 28. CONFIGURATION sylius_taxation: driver: doctrine/orm classes: tax_rate: model: AcmeShopBundleEntityTaxRate controller: AcmeShopBundleControllerTaxRateController repository: AcmeShopBundleEntityTaxRateRepository form: AcmeShopBundleFormTypeTaxRateType validation_groups: tax_rate: [sylius, acme]
  • 29. USING CUSTOM MODELS and FORMS Every model class can be overridden All repositories, managers and forms are updated automatically Form class can be customized
  • 30. OVERRIDING CONTROLLERS All models use default or slightly customized CRUD controller Add your own methods
  • 31. YOUR OWN REPOSITORY Sylius repositories extend native Doctrine implementations Override the repositories through configuration Repositories are services
  • 32. CHANGE THE RULES, VALIDATION All Sylius models ship with their own validation mapping under group „sylius” You can easily override it with your own rules Consistent translation messages
  • 33. DOCTRINE RTEL, DYNAMIC RELATIONS We're using interfaces instead of implementation to define the relations When you override the model class, all relations get updated automatically Defaults are turned into entities if you don't provide your own class
  • 34. WE LOVE EVENTS, YOU SHOULD TOO The default controller triggers multiple useful events during CRUD actions sylius.product.pre_create sylius.product.post_create
  • 37. ORDERS AND CART SyliusOrderBundle + SyliusCartBundle Generic Order model with support of Adjustments Cart bundle provides actions and services for customer to interact with the Order entity The order/cart items can be easily customized to handle different options
  • 39. COUNTRIES, ZONES AND ADDRESSES SyliusAddressingBundle Provides a very basic Address model Countries and their Provinces management Zones system with a ZoneMatcher service Useful for taxation and shipping zones
  • 40. $billingAddress = $order->getBillingAddress(); $zone = $this->zoneMatcher->match($billingAddress); $address = $location->getAddress(); $zones = $this->zoneMatcher->matchAll($address);
  • 41. TAKE CARE OF YOUR INVENTORY SyliusInventoryBundle Built around 1 interface you need to implement Tracks every single inventory unit Based on events Items available on demand Backorders
  • 42. HATE IT OR LOVE IT, TAXATION SyliusTaxationBundle TaxableInterface = heart of the bundle Multiple tax categories and rates support Customizable tax calculators Tax included in price
  • 43. MERCHANDISE NEEDS TO BE SHIPPED SyliusShippingBundle Integrate through one interface Manage Shipments and Shipping Methods Custom shipping rules Flexible calculators system
  • 44. class PerItemRateCalculator extends Calculator { public function calculate(ShippingSubjectInterface $subject, array $configuration) { return $configuration['amount'] * $subject->getShippingItemCount(); } public function getConfigurationFormType() { return 'sylius_shipping_calculator_per_item_rate_configuration'; } public function setConfiguration(OptionsResolverInterface $resolver) { $resolver ->setRequired(array( 'amount')) ->setAllowedTypes(array('amount' => array('numeric'))) ; } }
  • 46. CATEGORIZE ALL THIS STUFF, NOW SyliusTaxonomiesBundle Classify any Model using different Taxonomies Flexible forms Based on DoctrineExtensions
  • 48. JUST FEW STEPS MORE SyliusFlowBundle Useful for anything which takes more than 1 action to complete Checkouts, installation wizards, complex actions Used by OroCRM and Akeneo PIM for installers
  • 49. PROCESS SCENARIO <?php class CheckoutProcessScenario implements ProcessScenarioInterface { public function build(ProcessBuilderInterface $builder) { $builder ->add('security', 'sylius_checkout_security') ->add('addressing', 'sylius_checkout_addressing') ->add('shipping', 'sylius_checkout_shipping') ->add('payment', 'sylius_checkout_payment') ->add('finalize', 'sylius_checkout_finalize') ->add('purchase', 'sylius_checkout_purchase') ; } }
  • 50. PAYUM INTEGRATION SyliusPayumBundle NEW! Integrates Payum library into Sylius checkout Replaceable by other bundles in future PayPal Express Checkout and Stripe support Omnipay usage through a bridge
  • 51. Make your app configurable, EASILY SyliusSettingsBundle You can define settings schema and the form User edits the settings through UI You get the access via services and Twig
  • 52. Settings schema class GeneralSettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { $builder ->setDefaults(array( 'meta_keywords' => 'symfony, sylius, ecommerce, webshop, shopping cart', 'meta_description' => 'Sylius is modern ecommerce solution for PHP.', )) ->setAllowedTypes(array( 'meta_keywords' => array('string'), 'meta_description' => array('string'), )) ; }
  • 53. EDITING VIA FORM public function buildForm(FormBuilderInterface $builder) { $builder ->add('meta_keywords', 'text', array( 'constraints' => array(new NotBlank()) )) ->add('meta_description', 'textarea', array( 'constraints' => array(new NotBlank()) )) ; }
  • 55. PROMOTIONS ARE NICE SyliusPromotionsBundle Can be integrated with any Model Very flexible Actions and Rules system Support for promotion coupons
  • 56. PROMOTION STRUCTURE SUPER AWESOME PROMOTION ACTION RULE ACTION RULE ACTION
  • 57. CUSTOM RULES interface RuleCheckerInterface { /** * @param PromotionSubjectInterface $subject * @param array $configuration * * @return Boolean */ public function isEligible(PromotionSubjectInterface $subject, array $configuration); /** * @return string */ public function getConfigurationFormType(); }
  • 58. YOUR OWN ACTIONS class AddPackageAction implements PromotionActionInterface { public function execute(PromotionSubjectInterface $subject, array $configuration) { $package = $this->findPackage($configuration); $item = $this->cartItemRepository->createNew(); $item->setQuantity(1); $item->setUnitPrice(isset($configuration['price']) ? $configuration['price'] : $package->getGrossPrice()); $item->setPackage($package); $subject->addItem($item); } public function getConfigurationFormType() { return 'xyz_promotion_action_add_package_configuration'; } }
  • 60. Sylius Application How to bootstrap Symfony2 shop in minutes? (soon) Bringing smile back to developer's faces
  • 61. INSTALLATION $ composer create-project sylius/sylius -s dev path/to/install $ cd path/to/install $ app/console sylius:install $ composer create-project sylius/sylius-standard -s dev path/to/install $ cd path/to/install $ app/console sylius:install
  • 62. ONE CORE TO RULE THEM ALL SyliusCoreBundle Integrates all the bundles together Standard webshop application Contains all the models and services
  • 63. THE WEB INTERFACE SyliusWebBundle Provides the default web interface for Sylius Contains all the templates and menu builders Splitted into Frontend & Backend parts
  • 66. public function forwardAction(ProcessContextInterface $context) { $request = $this->getRequest(); $order = $this->getCurrentCart(); $this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_INITIALIZE, $order); $form = $this->createCheckoutAddressingForm($order); if ($request->isMethod('POST') && $form->bind($request)->isValid()) { $this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_PRE_COMPLETE, $order); $this->getManager()->persist($order); $this->getManager()->flush(); $this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_COMPLETE, $order); return $this->complete(); } return $this->renderStep($context, $order, $form); }
  • 68. TO DO Documentation, documentation, documentation New default store look Rework translations and integrate with CrowdIn Polish the checkout process Integrate BazingaHateoasBundle for API Integrate Symfony CMF and Create.js
  • 69. COMING SOON... Pull Requests Customer groups Subscriptions support Product reviews Symfony CMF integration (editable blocks and pages) Facebook/Amazon and so on...