Newly updated version of my Magento 2 intro talk - make sure to refer to this one, not the older ones!
Over 200,000 companies use the Magento 1 platform to power their eCommerce needs. So when they set out to build a major new version, the Magento team had significant pressure to deliver a modern, well-designed PHP-based system. Pulling in some of the best of the PHP world through tools like Composer, phpunit and more, I believe they met that goal. In this talk, we’ll take a look at the design and architecture of Magento 2, including it’s use of dependency injections, interceptors and service contracts to provide numerous ways for developers to extend and customize the system.
Presented at ZendCon 2015.
14. JoshuaWarren.com
A look at the state of the art when Magento 1 was built
PHP & Ecommerce in 2007
osCommerce is state of the art
Cloud-based / SaaS ecommerce doesn’t exist yet
PHP 5.2 is cutting-edge
Composer doesn’t exist - PHP has no dependency management
There’s this new thing called ZF, otherwise it’s Cake or Symfony
Testing? You might find a few people using PHPUnit
#ZendCon
15. JoshuaWarren.com
The Painful World of osCommerce
PHP & Ecommerce in 2007
Want to add an attribute? Modify your database schema on live.
Looking at add new features? Modify core PHP files.
Want to upgrade your store? Good luck!
#ZendCon
91. JoshuaWarren.com #ZendCon
CustomerRepositoryInterface.php
namespace MagentoCustomerApi;
/**
* Customer CRUD interface.
*/
interface CustomerRepositoryInterface
{
/**
* Create customer.
*
* @api
* @param MagentoCustomerApiDataCustomerInterface $customer
* @param string $passwordHash
* @return MagentoCustomerApiDataCustomerInterface
* @throws MagentoFrameworkExceptionInputException If bad input is provided
* @throws MagentoFrameworkExceptionStateInputMismatchException If the provided email is already used
* @throws MagentoFrameworkExceptionLocalizedException
*/
public function save(MagentoCustomerApiDataCustomerInterface $customer, $passwordHash = null);
92. JoshuaWarren.com #ZendCon
CustomerRepositoryInterface.php
/**
* Retrieve customer.
*
* @api
* @param string $email
* @param int|null $websiteId
* @return MagentoCustomerApiDataCustomerInterface
* @throws MagentoFrameworkExceptionNoSuchEntityException If customer with the specified email does not exist.
* @throws MagentoFrameworkExceptionLocalizedException
*/
public function get($email, $websiteId = null);
/**
* Retrieve customer.
*
* @api
* @param int $customerId
* @return MagentoCustomerApiDataCustomerInterface
* @throws MagentoFrameworkExceptionNoSuchEntityException If customer with the specified ID does not exist.
* @throws MagentoFrameworkExceptionLocalizedException
*/
public function getById($customerId);
130. JoshuaWarren.com #ZendCon
Model/Carrier.php
namespace MagentoSampleShippingProviderModel;
use PsrLogLoggerInterface;
use MagentoFrameworkAppConfigScopeConfigInterface;
use MagentoStoreModelScopeInterface;
use MagentoShippingModelCarrierAbstractCarrier;
use MagentoShippingModelCarrierCarrierInterface;
use MagentoShippingModelConfig;
use MagentoShippingModelRateResultFactory;
use MagentoQuoteModelQuoteAddressRateResultMethodFactory;
use MagentoQuoteModelQuoteAddressRateResultErrorFactory;
/**
* In-Store Pickup shipping model
*/
class Carrier extends AbstractCarrier implements CarrierInterface
{
/**
* @var string
*/
protected $_code = 'storepickup';
/**
* @var bool
*/
protected $_isFixed = true;
… see https://github.com/magento/magento2-samples/blob/master/sample-module-shipping-provider/Model/Carrier.php
143. Dev Docs
Team of hard-working technical writers (not developers)
Writing documentation for a system that has yet to be used ‘in
the wild’
Very eager for feedback and input - they don’t know what
documentation you need
Very open to pull requests of documentation or just open an
issue on Github with feedback + requests
JoshuaWarren.com #ZendCon
147. JoshuaWarren.com
As a freelancer…
Learning Magento 2
Set aside time in your week to learn the design patterns Magento 2 uses
Work through the sample code the Magento 2 team has provided
Begin experimenting with developing with Magento 2
Do not try to learn ‘on the job’ - be careful accepting M2 work before you’re ready
#ZendCon
148. JoshuaWarren.com
As an in-house developer for a merchant…
Learning Magento 2
Determine when your business is likely to migrate to Magento 2
First 2-4 weeks of your Magento 2 migration schedule should be learning Magento 2
Learn the patterns before you start!
#ZendCon
149. JoshuaWarren.com
As an agency or industry partner…
Learning Magento 2
Create a tiger team of developers focused on Magento 2
Allow those developers time in the day to learn Magento 2
Those developers should implement your first Magento 2 projects
That team then helps the rest of your team through the learning curve
#ZendCon
150. JoshuaWarren.com
When do I need to be Magento 2 ready?
Learning Magento 2
Magento 2 will be released late enough in the year that most
merchants won’t begin using it immediately.
Merchants will also wait until their mission-critical extensions are
available on Magento 2.
Start learning it now - but don’t panic!
#ZendCon