Issue
I am using CakePHP (v3.0), and my Controller code is as below:
namespace App\Controller;
class ArticlesController extends AppController{
public function index(){
$context = new BLTI("secret", true, false);
}
}
I want to create a BLTI
object. I have a folder whose name is ims
that contains the following PHP files:
- blti.php (contains two class, one of them is "BLTI")
- blti_util.php
- OAuth.php
I have placed this ims
folder in vendor
directory. My problem is that i don't know how I must import this ims
folder in my Controller to use it.
Solution
App::import() has been removed in CakePHP 3.0, so simply require() the files and use the use
statement to load the classes into your namespace.
Normally you would just add them to your autoloader, but obviously these files and classes are pretty old and don't care about best practice (one class per file) or follow any convention for automated file loading.
You could change the files naming of that lib as well so that they can be used with the autoloader. Should be easy to do as well.
Answered By - floriank
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.