SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Sergey Lysak
CEO at Eltrino
Make implementation of third-party elements in
Magento 2 in 5-times easier
Sergey Lysak
CEO at Eltrino
We serve B2C & B2B web stores on Magento by delivering the most advanced
eCommerce solutions - front-end and back-end Magento and OroCRM
development, integrations & functional improvements, custom modules &
extensions, eCommerce consulting and managed services.
Also we’re creating new open source customer care solution - DiamanteDesk.
Agenda
1. Typical issues in Magento 2 that can be solved by Composer
2. Magic Magento-composer-installer
3. Example of implementation of third-party libraries
4. How to create new module
5. Backend validation comparison
6. Conclusions
Composer –
Dependency Manager for
PHP
Composer allows you to declare the libraries
your project depends on, and will manage
(install/update) them for you.
Sometimes it’s called library manager - it works
in general, but for definite local project Composer
is Dependency Manager.
It’s a new era of developer’s
laziness and it’s called
Composer-ing)))
Typical issues that can be solved by
Composer
● Project dependency management of third-party libraries.
● Resolution of conflicts of libraries and priorities.
● Find and download into the project correct versions of libraries
● Generation autoload.php
Magento 2 and Composer combination
features:
● Provides the ability to use third-party libraries while you don’t have to bundle them
with source code of Magento 2.
● Offers a component-based architecture as well as reliable dependency management.
● Reduces extension conflicts as well as various compatibility issues.
● Streamlines your work with versioned dependencies.
● Introduces semantic versioning.
● Supports some useful standards, such as PHP Framework Interoperability.
Composer in Magento 2
● Magento 2 installer
● Magento-composer-installer
There are 2 ways how to install an extension in
Magento 2:
1 - download from marketplace and handle it
manually, copying the code and doing other required
actions
2 - use special official Magento plugin Magento-
composer-installer
I want to tell you more about the second solution. It
allows you to avoid wasting of time and just with one
line of code place your new module in required folder.
Just type in Composer the name of new module and
it will transfer it.
How to install Composer in Magento 2
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer list --help
● Enter in command prompt:
If command help displays, Composer is already installed.
● To install Composer: Change to or create an empty directory on your Magento
server. And enter:
composer --help or
Moving from Magento 1 to Magento 2
is alike the fall of the Berlin Wall
Magento 1 is like a monolith structure, where each
module is like another brick in the wall.
In Magento 2 all modules are separated and
independent like bricks of the broken wall. Except
modules that are marked as “dependent” in the
configuration. So the Composer helps to crash the
unbreakable wall.
And I repeat it once again that now thanks to the
Composer you can create custom Magento
configuration, throw away unnecessary modules and
install third-party libraries.
All files related to modules even templates are placed
in corresponding modules.
Everything you have to do is just to include Composer
in Magento configuration.
Composer in Magento 2
Available Composer packages in Magento 2
● magento2-module - code inserted into app/code
● magento2-theme - code inserted into app/design
● magento2-language - code inserted into app/i18n
● magento2-library - code inserted into lib/internal
● magento2-component - code inserted into root of magento installation
Composer in Magento 2
If any component of the system doesn’t meet requirements Composer
will recommend to update the component and it won’t let Magento or
Magento module to install.
Module installation
bash-4.3$
bash-4.3$ composer require vendor/module:version
bash-4.3$ *** some magic ***
bash-4.3$ Done.
bash-4.3$
Magic Magento-composer-installer
Module configuration for Composer
Example of implementation of third-party
libraries
Google ReCaptcha
Search and and installing the necessary
libraries
http://packagist.org
google/recaptcha
bash-4.3$ composer require google/recaptcha
bash-4.3$ *** some magic ***
bash-4.3$ Done.
Existing complications in creating modules
for Magento 2
• To build structure from scratch - too long
• The use of simple modules - is deprecated
• ihb/moduleCreator - ok
Module installation ihb/moduleCreator
bash-4.3$
bash-4.3$ composer require ihb/moduleCreator:dev-
master
bash-4.3$ *** some magic ***
bash-4.3$ Done.
bash-4.3$
bash-4.3$ bin/magento setup:upgrade
ihb/ModuleCreator Introducing you a simple Magento 2 module creator.
How to install it?
Add repository url to the root composer.json file example:
ihb/moduleCreator:dev-master
How to create new module
bash-4.3$
bash-4.3$ bin/magento ihb:module-create
Vendor_Module
bash-4.3$
bash-4.3$ bin/magento setup:upgrade
How to use new module
After Module Creator activated, just run php -f bin/magento ihb:module-create
Vendor_Module command. This will create simple module structure in
app/code/Vendor/Module folder.
The structure of the new module
Here is generated structure of the new module. You need to rename folders and delete unnecessary that
you won’t need
Add captcha output to contact form
Template you can easily find on https://github.com/google/recaptcha or
http://www.google.com/recaptcha/intro/index.html
Just copy and insert the code
magento2/app/code/Eltrino/ReCaptcha/view/frontend/layout/contact_index_index.xml
magento2/app/code/Eltrino/ReCaptcha/view/frontend/templates/captcha.phtml
Result
Backend validation – Observer
magento2/app/code/Eltrino/ReCaptcha/etc/events.xml
To make it alive we need to embed validation on the backend
For this we’ll use Observer pattern and Magento events
Before saving data from the form we need to validate captcha code
For this we create Predispatch Observer
Observer Differences in Magento 1 and
Magento 2
While the majority of the mechanic remains the same as it did in Magento 1, there are a few differences in Magento2
● Each observer is in its own class. You no longer have an entire observer class that holds all observer code.
● Observers are in their own folder. You do not put observers in the model folder anymore. They are located in
the Observer/ folder in your module.
● Observer XML is located in the events.xml file. A common trend among Magento 2 is to separate all XML
according to functional destiny. This means that all XML is separated according to its purpose. All events go in
their own XML files. All controller routes go in another, and so on.
● Observers in Magento 2 use Symfony event dispatcher
● Separation by area is done by placing event xml file into specific folder. E.g. etc/events.xml for all areas,
etc/frontend/events.xml (for the frontend), etc/adminhtml/events.xml (for the backend), etc.
In general there are less events in the code and alongside with events so called plugins are also introduced and used
in Magento 2.
Validation
And actually how our
validation looks
ReCaptcha/ReCaptcha
- is our third-party library
that we’ve installed.
Pay attention, to check
Captcha we need just 2
lines of code!
Comparison
There are just 314 lines in
our code
In embedded third-party
library - 1670
So without composer to
implement recaptcha
feature in contact form we
need to create around
2000 lines of code
314 lines of code it’s 2-3
hours of development
2000 lines of code -
around 12-18 hours
Don't relax! Even if you upgrade one of your components even
between minor versions you need to test your upgraded component
Conclusions
What you should
remember from
this presentation:
Composer makes
implementation of
third-party elements in
Magento 2 in 5-times
easier
We saved 10-15 hours
Our code is light and
clear
Our happy developers
have time for sport)))
Thank you for
attention!
sergey@eltrino.com

Weitere ähnliche Inhalte

Was ist angesagt?

How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)Magestore
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2Magestore
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Mathew Beane
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design PatternsMax Pronko
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhubMagento Dev
 
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015Joshua Warren
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]M-Connect Media
 
Magento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce PowerhouseMagento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce PowerhouseBen Marks
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceMeet Magento Italy
 
Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeBen Marks
 
The journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersThe journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersGabriel Guarino
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksYireo
 
Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Meet Magento Italy
 
The Installer - BarCamp - Meet Magento 2014 Germany
The Installer - BarCamp - Meet Magento 2014 GermanyThe Installer - BarCamp - Meet Magento 2014 Germany
The Installer - BarCamp - Meet Magento 2014 GermanyJacques Bodin-Hullin
 
Magento 2 Development Best Practices
Magento 2 Development Best PracticesMagento 2 Development Best Practices
Magento 2 Development Best PracticesBen Marks
 
Max Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMax Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMeet Magento Italy
 
Magento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagenest
 

Was ist angesagt? (20)

How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2
 
Composer in Magento
Composer in MagentoComposer in Magento
Composer in Magento
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design Patterns
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]
 
Magento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce PowerhouseMagento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce Powerhouse
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performance
 
Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento Code
 
The journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersThe journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developers
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
 
Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2
 
The Installer - BarCamp - Meet Magento 2014 Germany
The Installer - BarCamp - Meet Magento 2014 GermanyThe Installer - BarCamp - Meet Magento 2014 Germany
The Installer - BarCamp - Meet Magento 2014 Germany
 
Composer and Git in Magento
Composer and Git in MagentoComposer and Git in Magento
Composer and Git in Magento
 
12 Amazing Features of Magento 2
12 Amazing Features of Magento 212 Amazing Features of Magento 2
12 Amazing Features of Magento 2
 
Magento 2 Development Best Practices
Magento 2 Development Best PracticesMagento 2 Development Best Practices
Magento 2 Development Best Practices
 
Max Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMax Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overview
 
Magento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | Magenest
 

Ähnlich wie Make implementation of third-party elements in Magento 2 in 5-times easier with Composer

Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionSergii Shymko
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoIRJET Journal
 
How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0Daniele Crupi
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupaldrubb
 
Convert Magento 1 Extensions to Magento 2
Convert Magento 1 Extensions to Magento 2Convert Magento 1 Extensions to Magento 2
Convert Magento 1 Extensions to Magento 2Vladimir Kerkhoff
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookTrọng Huỳnh
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentKapil Dev Singh
 
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Meet Magento Italy
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionSergii Shymko
 
Dependency management in Magento with Composer
Dependency management in Magento with ComposerDependency management in Magento with Composer
Dependency management in Magento with ComposerManuele Menozzi
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool boxbpowell29a
 
php[world] Magento101
php[world] Magento101php[world] Magento101
php[world] Magento101Mathew Beane
 
Creating Openbravo Workspace Widgets
Creating Openbravo Workspace WidgetsCreating Openbravo Workspace Widgets
Creating Openbravo Workspace WidgetsRob Goris
 
Git for work groups ironhack talk
Git for work groups ironhack talkGit for work groups ironhack talk
Git for work groups ironhack talkTiago Ameller
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoDevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoMagento Dev
 
Magento 2 Spam and Bot Blocker
Magento 2 Spam and Bot BlockerMagento 2 Spam and Bot Blocker
Magento 2 Spam and Bot BlockerMageAnts
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git WorkshopBeckhamWee
 

Ähnlich wie Make implementation of third-party elements in Magento 2 in 5-times easier with Composer (20)

Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Magento 2 + composer
Magento 2 + composerMagento 2 + composer
Magento 2 + composer
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions Distribution
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of Magento
 
How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
 
Convert Magento 1 Extensions to Magento 2
Convert Magento 1 Extensions to Magento 2Convert Magento 1 Extensions to Magento 2
Convert Magento 1 Extensions to Magento 2
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
 
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
 
Magento Meetup New Delhi- Console
Magento Meetup New Delhi- ConsoleMagento Meetup New Delhi- Console
Magento Meetup New Delhi- Console
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions Distribution
 
Dependency management in Magento with Composer
Dependency management in Magento with ComposerDependency management in Magento with Composer
Dependency management in Magento with Composer
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
php[world] Magento101
php[world] Magento101php[world] Magento101
php[world] Magento101
 
Creating Openbravo Workspace Widgets
Creating Openbravo Workspace WidgetsCreating Openbravo Workspace Widgets
Creating Openbravo Workspace Widgets
 
Git for work groups ironhack talk
Git for work groups ironhack talkGit for work groups ironhack talk
Git for work groups ironhack talk
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoDevHub 3 - Composer plus Magento
DevHub 3 - Composer plus Magento
 
Magento 2 Spam and Bot Blocker
Magento 2 Spam and Bot BlockerMagento 2 Spam and Bot Blocker
Magento 2 Spam and Bot Blocker
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
 

Mehr von Elena Kulbich

How to handle multi everything - Sergey Lysak, Eltrino
How to handle multi everything - Sergey Lysak, EltrinoHow to handle multi everything - Sergey Lysak, Eltrino
How to handle multi everything - Sergey Lysak, EltrinoElena Kulbich
 
Magento 2 SEO lucky chance
Magento 2 SEO lucky chanceMagento 2 SEO lucky chance
Magento 2 SEO lucky chanceElena Kulbich
 
Многоканальная поддержка клиентов
Многоканальная поддержка клиентовМногоканальная поддержка клиентов
Многоканальная поддержка клиентовElena Kulbich
 
Multi channel customer support by Sergey Lysak
Multi channel customer support by Sergey LysakMulti channel customer support by Sergey Lysak
Multi channel customer support by Sergey LysakElena Kulbich
 
Pioneers kyiv#1 presentation
Pioneers kyiv#1 presentationPioneers kyiv#1 presentation
Pioneers kyiv#1 presentationElena Kulbich
 
Multi channel customer support Sergey Lysak
Multi channel customer support Sergey LysakMulti channel customer support Sergey Lysak
Multi channel customer support Sergey LysakElena Kulbich
 
DiamanteDesk for StartupLab
DiamanteDesk for StartupLabDiamanteDesk for StartupLab
DiamanteDesk for StartupLabElena Kulbich
 

Mehr von Elena Kulbich (8)

How to handle multi everything - Sergey Lysak, Eltrino
How to handle multi everything - Sergey Lysak, EltrinoHow to handle multi everything - Sergey Lysak, Eltrino
How to handle multi everything - Sergey Lysak, Eltrino
 
Magento 2 SEO lucky chance
Magento 2 SEO lucky chanceMagento 2 SEO lucky chance
Magento 2 SEO lucky chance
 
Многоканальная поддержка клиентов
Многоканальная поддержка клиентовМногоканальная поддержка клиентов
Многоканальная поддержка клиентов
 
Multi channel customer support by Sergey Lysak
Multi channel customer support by Sergey LysakMulti channel customer support by Sergey Lysak
Multi channel customer support by Sergey Lysak
 
Pioneers kyiv#1 presentation
Pioneers kyiv#1 presentationPioneers kyiv#1 presentation
Pioneers kyiv#1 presentation
 
Multi channel customer support Sergey Lysak
Multi channel customer support Sergey LysakMulti channel customer support Sergey Lysak
Multi channel customer support Sergey Lysak
 
DiamanteDesk for StartupLab
DiamanteDesk for StartupLabDiamanteDesk for StartupLab
DiamanteDesk for StartupLab
 
DiamanteDesk
DiamanteDeskDiamanteDesk
DiamanteDesk
 

Kürzlich hochgeladen

CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 

Kürzlich hochgeladen (20)

@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 

Make implementation of third-party elements in Magento 2 in 5-times easier with Composer

  • 1. Sergey Lysak CEO at Eltrino Make implementation of third-party elements in Magento 2 in 5-times easier
  • 2. Sergey Lysak CEO at Eltrino We serve B2C & B2B web stores on Magento by delivering the most advanced eCommerce solutions - front-end and back-end Magento and OroCRM development, integrations & functional improvements, custom modules & extensions, eCommerce consulting and managed services. Also we’re creating new open source customer care solution - DiamanteDesk.
  • 3. Agenda 1. Typical issues in Magento 2 that can be solved by Composer 2. Magic Magento-composer-installer 3. Example of implementation of third-party libraries 4. How to create new module 5. Backend validation comparison 6. Conclusions
  • 4. Composer – Dependency Manager for PHP Composer allows you to declare the libraries your project depends on, and will manage (install/update) them for you. Sometimes it’s called library manager - it works in general, but for definite local project Composer is Dependency Manager.
  • 5. It’s a new era of developer’s laziness and it’s called Composer-ing)))
  • 6. Typical issues that can be solved by Composer ● Project dependency management of third-party libraries. ● Resolution of conflicts of libraries and priorities. ● Find and download into the project correct versions of libraries ● Generation autoload.php
  • 7. Magento 2 and Composer combination features: ● Provides the ability to use third-party libraries while you don’t have to bundle them with source code of Magento 2. ● Offers a component-based architecture as well as reliable dependency management. ● Reduces extension conflicts as well as various compatibility issues. ● Streamlines your work with versioned dependencies. ● Introduces semantic versioning. ● Supports some useful standards, such as PHP Framework Interoperability.
  • 8. Composer in Magento 2 ● Magento 2 installer ● Magento-composer-installer There are 2 ways how to install an extension in Magento 2: 1 - download from marketplace and handle it manually, copying the code and doing other required actions 2 - use special official Magento plugin Magento- composer-installer I want to tell you more about the second solution. It allows you to avoid wasting of time and just with one line of code place your new module in required folder. Just type in Composer the name of new module and it will transfer it.
  • 9. How to install Composer in Magento 2 curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer composer list --help ● Enter in command prompt: If command help displays, Composer is already installed. ● To install Composer: Change to or create an empty directory on your Magento server. And enter: composer --help or
  • 10. Moving from Magento 1 to Magento 2 is alike the fall of the Berlin Wall Magento 1 is like a monolith structure, where each module is like another brick in the wall. In Magento 2 all modules are separated and independent like bricks of the broken wall. Except modules that are marked as “dependent” in the configuration. So the Composer helps to crash the unbreakable wall. And I repeat it once again that now thanks to the Composer you can create custom Magento configuration, throw away unnecessary modules and install third-party libraries. All files related to modules even templates are placed in corresponding modules. Everything you have to do is just to include Composer in Magento configuration.
  • 11. Composer in Magento 2 Available Composer packages in Magento 2 ● magento2-module - code inserted into app/code ● magento2-theme - code inserted into app/design ● magento2-language - code inserted into app/i18n ● magento2-library - code inserted into lib/internal ● magento2-component - code inserted into root of magento installation
  • 12. Composer in Magento 2 If any component of the system doesn’t meet requirements Composer will recommend to update the component and it won’t let Magento or Magento module to install.
  • 13. Module installation bash-4.3$ bash-4.3$ composer require vendor/module:version bash-4.3$ *** some magic *** bash-4.3$ Done. bash-4.3$
  • 15. Example of implementation of third-party libraries Google ReCaptcha
  • 16. Search and and installing the necessary libraries http://packagist.org google/recaptcha bash-4.3$ composer require google/recaptcha bash-4.3$ *** some magic *** bash-4.3$ Done.
  • 17. Existing complications in creating modules for Magento 2 • To build structure from scratch - too long • The use of simple modules - is deprecated • ihb/moduleCreator - ok
  • 18. Module installation ihb/moduleCreator bash-4.3$ bash-4.3$ composer require ihb/moduleCreator:dev- master bash-4.3$ *** some magic *** bash-4.3$ Done. bash-4.3$ bash-4.3$ bin/magento setup:upgrade ihb/ModuleCreator Introducing you a simple Magento 2 module creator. How to install it? Add repository url to the root composer.json file example: ihb/moduleCreator:dev-master
  • 19. How to create new module bash-4.3$ bash-4.3$ bin/magento ihb:module-create Vendor_Module bash-4.3$ bash-4.3$ bin/magento setup:upgrade How to use new module After Module Creator activated, just run php -f bin/magento ihb:module-create Vendor_Module command. This will create simple module structure in app/code/Vendor/Module folder.
  • 20. The structure of the new module Here is generated structure of the new module. You need to rename folders and delete unnecessary that you won’t need
  • 21. Add captcha output to contact form Template you can easily find on https://github.com/google/recaptcha or http://www.google.com/recaptcha/intro/index.html Just copy and insert the code magento2/app/code/Eltrino/ReCaptcha/view/frontend/layout/contact_index_index.xml magento2/app/code/Eltrino/ReCaptcha/view/frontend/templates/captcha.phtml
  • 23. Backend validation – Observer magento2/app/code/Eltrino/ReCaptcha/etc/events.xml To make it alive we need to embed validation on the backend For this we’ll use Observer pattern and Magento events Before saving data from the form we need to validate captcha code For this we create Predispatch Observer
  • 24. Observer Differences in Magento 1 and Magento 2 While the majority of the mechanic remains the same as it did in Magento 1, there are a few differences in Magento2 ● Each observer is in its own class. You no longer have an entire observer class that holds all observer code. ● Observers are in their own folder. You do not put observers in the model folder anymore. They are located in the Observer/ folder in your module. ● Observer XML is located in the events.xml file. A common trend among Magento 2 is to separate all XML according to functional destiny. This means that all XML is separated according to its purpose. All events go in their own XML files. All controller routes go in another, and so on. ● Observers in Magento 2 use Symfony event dispatcher ● Separation by area is done by placing event xml file into specific folder. E.g. etc/events.xml for all areas, etc/frontend/events.xml (for the frontend), etc/adminhtml/events.xml (for the backend), etc. In general there are less events in the code and alongside with events so called plugins are also introduced and used in Magento 2.
  • 25. Validation And actually how our validation looks ReCaptcha/ReCaptcha - is our third-party library that we’ve installed. Pay attention, to check Captcha we need just 2 lines of code!
  • 26. Comparison There are just 314 lines in our code In embedded third-party library - 1670 So without composer to implement recaptcha feature in contact form we need to create around 2000 lines of code 314 lines of code it’s 2-3 hours of development 2000 lines of code - around 12-18 hours
  • 27. Don't relax! Even if you upgrade one of your components even between minor versions you need to test your upgraded component
  • 28. Conclusions What you should remember from this presentation: Composer makes implementation of third-party elements in Magento 2 in 5-times easier We saved 10-15 hours Our code is light and clear Our happy developers have time for sport)))