building a framework agnostic api
TRANSCRIPT
![Page 1: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/1.jpg)
Building a framework agnostic API
David Manners@mannersd
![Page 2: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/2.jpg)
How to un-Magento your Magento code/developers
David Manners@mannersd
![Page 3: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/3.jpg)
Disclaimers
• Not for all,• Not perfect,• Will not code for you!• Love to build in blocks,
![Page 4: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/4.jpg)
Are you sitting comfortably
![Page 5: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/5.jpg)
Are you sitting comfortably
• Magento 1 EOL,• New customer,• Lots of integrations,• Migration possible,
![Page 6: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/6.jpg)
ERP API Magento
![Page 7: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/7.jpg)
How do you build this?
![Page 8: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/8.jpg)
What on earth is a store?
![Page 9: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/9.jpg)
Interface everything!
![Page 10: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/10.jpg)
Interface everything
• Take your domain and enforce your properties,• Tell frameworks how to interact with your domain,
![Page 11: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/11.jpg)
Domain Objects
![Page 12: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/12.jpg)
A middleware
![Page 13: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/13.jpg)
A middleware
• Pick one you like!• Take request,• Give response,• SIMPLES!
![Page 14: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/14.jpg)
Response/Request parsing
![Page 15: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/15.jpg)
Build a bridge
![Page 16: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/16.jpg)
The results!
![Page 17: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/17.jpg)
The results!
• Ready to go with M1,• Ready to switch to M2,• Happy Customer?• Happy Developers?
![Page 18: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/18.jpg)
All that glitters is not gold
![Page 19: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/19.jpg)
Build from the interfaces
![Page 20: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/20.jpg)
Store Interface
interface StoreInterface{ public function getIdentifier(); public function getCode(); public function getName(); public function getActive();}
![Page 21: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/21.jpg)
StoreRepositoryInterface
interface StoreRepositoryInterface{ public function find(array $ids = []); public function save(StoreInterface $store);}
![Page 22: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/22.jpg)
ExporterInterface
interface ExporterInterface{ public function setIdentifier(array $identifier = []); public function execute();}
![Page 23: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/23.jpg)
ImporterInterface
interface ImporterInterface{ public function execute();}
![Page 24: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/24.jpg)
Bridge Interface
interface BridgeInterface{ public function getPageRepository();}
![Page 25: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/25.jpg)
Build from the interfaces
• implement ExporterInterface• implement ImporterInterface• implement StoreInterface
![Page 26: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/26.jpg)
Build from the interfaces (M1/M2)
• Implement BridgeInterface,• Implement StoreRepositoryInterface
![Page 27: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/27.jpg)
Let Magento do Magento
![Page 28: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/28.jpg)
Do one thing well
![Page 29: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/29.jpg)
Free your developers
![Page 30: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/30.jpg)
Enjoy coding again
![Page 31: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/31.jpg)
Can I see it?
• https://github.com/sitewards/setup• https://github.com/sitewards/setup-mage2• https://github.com/sitewards/setup-mage1
![Page 32: Building a framework agnostic API](https://reader033.vdocuments.us/reader033/viewer/2022051521/5a6751e77f8b9a656a8b4645/html5/thumbnails/32.jpg)
Building a framework agnostic API
David Manners@mannersd