Building a framework agnostic API

Download Building a framework agnostic API

Post on 23-Jan-2018




4 download


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? a framework agnostic APIDavid Manners@mannersd