Magento 2.2 example modules to show how things work in M2.2 The examples probably also work in M 2.3.
You can either download the zip file, or clone the repo or install with composer.
If you prefer to download the code in the zip file then place the files in app/code. If the folder "code" do not exist then create it.
In your Magento you have a composer.json, add the repository like this:
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/"
},
{
"type": "vcs",
"url": "git@github.com:peterlembke/m2-examples.git"
}
],
And then install like this:
composer require peterlembke/m2-examples -n
The modules will be installed in the vendor folder. The paths do not look like other modules and that is just cosmetic. I wanted it to be easy for those that prefer downloading the zip file.
You can see that the modules are recognized by Magento like this
php bin/magento module:status
and you can enable a module with
php bin/magento module:enable CharZam_Config
Here are the examples in this repository
With di.xml you can do dependency injection, substitute a class, extend a class, change class arguments, create virtual type.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/DiExample
With Plugins you get access to the variables before they are given to a function, and you get access to the return value before it is sent to the caller.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Plugins
You can delay initialization of classes until they are really used. That is done with a proxy. No need to change any code at all, just configure in di.xml that you want this on some class injections. Magento take care of the rest. This can Improove performance!!.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/UseProxy
With a factory object you can create new empty objects of a specific type. For example when you want to create new customers or products. This example is also about singleton (shared objects).
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Factory
You can dispatch events and attach any data. In your observer you get READ ONLY data that you can act on. If you need to send data back, then use a plugin instead.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Events
With cron you can schedule tasks to run regularily. In this module you see how to set up jobs, deparate business logic and test the job. The documentation is a bit more extensive in this module.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Crontab
You can create your own Admin config. See this module how it is done.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Config
React on the URLs with controllers. In this example you learn how to redirect or forward a request. How to return a page or a json or a raw response. How to make a no route that catch those URLs that no one else have catched.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Controller
Store data in a table. How to add data, read, write, delete, search data.
https://github.com/peterlembke/m2-examples/tree/master/src/magento2/app/code/CharZam/Database
Resources how you can study Magento 2 more in depth.
There are now five different certifications you can take for Magento 2.2. https://u.magento.com/certification
- MAGENTO 2 CERTIFIED SOLUTION SPECIALIST
- MAGENTO 2 CERTIFIED ASSOCIATE DEVELOPER EXAM
- MAGENTO 2 CERTIFIED PROFESSIONAL FRONT END DEVELOPER
- MAGENTO 2 CERTIFIED PROFESSIONAL JAVASCRIPT DEVELOPER
- MAGENTO 2 CERTIFIED PROFESSIONAL DEVELOPER
Below are resources for the MAGENTO 2 CERTIFIED PROFESSIONAL DEVELOPER exam.
You get practical tips what awaits on the test day.
https://www.integer-net.com/magento-2-certified-professional-developer-about-the-exam/
https://www.mw2consulting.com/blog/tips-prepare-magento-2-developer-certification-exam
Swift Otter give you a large PDF with a lot of information in every area. Very useful.
https://swiftotter.com/technical/certifications/magento-2-certified-developer-study-guide
Exam notes is a very useful condensed material that have a lot of references to other pages.
https://github.com/magento-notes/magento2-exam-notes
The official study guide is not very useful except for the intimidating examples in there.
https://u.magento.com/free-study-guide
You can always trust Alan Storm to have the detailed analyzes of different M2 areas.
https://alanstorm.com/category/magento-2/
The Magento documentation is a valuable source. You will end up here by reference if you follow the "Exam notes" above.
https://devdocs.magento.com/#/individual-contributors
Very useful document that show the intent from Magento, how they expect code to be written.
https://devdocs.magento.com/guides/v2.2/coding-standards/technical-guidelines.html
Magento also has study groups.
https://u.magento.com/magento-2-certified-developer-study-group#.W9rPm3pKgZJ