I need to integrate Authorize.net payment gateway to my Zf2 application. Downloaded and copied the PHP SDK in php include path. The sdk has the following files
+authoriznet
+doc
+lib
+shared
+ssl
-AuthorizeNetSIM.php (and more)
-AuthorizeNet.php
My code (Zend controller) is
require_once 'path/AuthorizeNet.php'; /*This require_once AuthorizeNetSIM.php and other files)*/
class PurchaseController extends AbstractActionController{
public purchaseAction(){
$works = new AuthorizeNetException("test"); //A class defined in AuthorizeNet.php
$notFound = new AuthorizeNetSIM;
}
}
$works -> works fine, where as $notFound throws class not found exception
If i add require_once in view file (.phtml) then all classes in sdk is available to use.
Can someone explain this behaviour? How to properly use this 3rd party library in Zf2?