AuthorizeNet / sample-code-php

This repository contains working code samples which demonstrate php integration with the Authorize.Net API
MIT License
175 stars 197 forks source link

PHP FrameWorks (MVC) and 'use' operator #137

Closed donovandb closed 5 years ago

donovandb commented 5 years ago

Hello, The sample code has stuff like: require 'vendor/autoload.php'; require_once 'constants/SampleCodeConstants.php'; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController;

When working in CodeIgniter (for example), or any framework that uses Model View Controller, the use of the 'use' operator is not permitted inside functions.. which is how one usually creates payment gateways in these FrameWorks (Function inside of a controller include.. or in my case, a "helper" function).

What is the recommended sample code for using the API in these frameworks?.. or rather, specifically... inside functions?

donovandb commented 5 years ago

Just a followup. I have managed this. Please see here for a codeigniter guide: https://forum.codeigniter.com/thread-72281.html

ashtru commented 5 years ago

Thank you for sharing your implementation this with us, @donovandb ! Closing this issue. Feel free to reopen in case of updates or queries.