Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import vendor files in CakePHP 3x

I'm working with CakePHP 3(beta 2) version recently launched. I need to integrate Facebook Login using PHP SDKs and I'm not clear with importing vendor files in this version.
In CakePHP 2x, I had used

App::import('Vendor', 'Facebook', array('file' => 'Facebook' . DS . 'src'. DS. 'facebook.php'));

So I need to reproduce the same in CakePHP 3x(I'm not using composer).
Any reference for this?

like image 447
G.J Avatar asked Oct 25 '14 13:10

G.J


1 Answers

Well you will have to load it yourself if composer is not an option. You can always use the very basic require method and create a new instance of the vendor class yourself. Reference: http://book.cakephp.org/3.0/en/core-libraries/app.html#loading-vendor-files

Use:

 //The following line should do the same like App::import() in the older version of cakePHP
 require_once(ROOT . 'vendor' . DS  . 'Facebook' . DS . 'src' . DS . 'facebook.php');

 $facebookApi = new facebook();
like image 70
Ayman Bedair Avatar answered Sep 21 '22 05:09

Ayman Bedair