Wednesday, March 8, 2017

Autoloading Php file that contains multiple classes in laravel

Good day guys. Please I am stucked on this problem and i want help. I have this php file that i have included multiple classes. I want to autoload those classes so that laravel can execute them. How do i go about it

The codes below can be found in app/mpower/mpower.php and the required files are in other directories nested in the mpower directory.

how do i autoload these classes so that i can use all the classes in the other subsequent files

<?php
require_once("mpower/dependency_check.php");

set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__)));

abstract class MPower {
  const VERSION = "1.2.0";
  const SUCCESS = "success";
  const FAIL = "fail";
  const PENDING = "pending";
}

if (strnatcmp(phpversion(),'5.3.0') >= 0) {
  define('JSON_ENCODE_PARAM_SUPPORT',   true);
}else{
  define('JSON_ENCODE_PARAM_SUPPORT',   false);
}

///define("MPOWER_SUCCESS", "success");
//define("MPOWER_FAIL", "fail");
//define("MPOWER_PENDING", "pending");

require_once("mpower/setup.php");
require_once("mpower/customdata.php");
require_once("mpower/checkout.php");
require_once("mpower/checkout/store.php");
require_once("mpower/checkout/checkout_invoice.php");
require_once("mpower/checkout/onsite_invoice.php");
require_once("mpower/direct_pay.php");
require_once("mpower/direct_card.php");
require_once("mpower/libraries/Requests.php");
require_once("mpower/utilities.php");



via Ernesto

Advertisement