Building a framework agnostic API

Download Building a framework agnostic API

Post on 23-Jan-2018

215 views

Category:

Software

4 download

TRANSCRIPT

Building a framework agnostic APIDavid Manners@mannersdHow to un-Magento your Magento code/developersDavid Manners@mannersdDisclaimers Not for all, Not perfect, Will not code for you! Love to build in blocks,Are you sitting comfortablyAre you sitting comfortably Magento 1 EOL, New customer, Lots of integrations, Migration possible,ERP API MagentoHow do you build this?What on earth is a store?Interface everything!Interface everything Take your domain and enforce your properties, Tell frameworks how to interact with your domain,Domain ObjectsA middlewareA middleware Pick one you like! Take request, Give response, SIMPLES!Response/Request parsingBuild a bridgeThe results!The results! Ready to go with M1, Ready to switch to M2, Happy Customer? Happy Developers?All that glitters is not goldBuild from the interfacesStore Interfaceinterface StoreInterface{ public function getIdentifier(); public function getCode(); public function getName(); public function getActive();}StoreRepositoryInterfaceinterface StoreRepositoryInterface{ public function find(array $ids = []); public function save(StoreInterface $store);}ExporterInterfaceinterface ExporterInterface{ public function setIdentifier(array $identifier = []); public function execute();}ImporterInterfaceinterface ImporterInterface{ public function execute();}Bridge Interfaceinterface BridgeInterface{ public function getPageRepository();}Build from the interfaces implement ExporterInterface implement ImporterInterface implement StoreInterfaceBuild from the interfaces (M1/M2) Implement BridgeInterface, Implement StoreRepositoryInterfaceLet Magento do MagentoDo one thing wellFree your developersEnjoy coding againCan I see it? https://github.com/sitewards/setup https://github.com/sitewards/setup-mage2 https://github.com/sitewards/setup-mage1https://github.com/sitewards/setuphttps://github.com/sitewards/setup-mage2https://github.com/sitewards/setup-mage1Building a framework agnostic APIDavid Manners@mannersd