FindNerd
FindNerd, a niche Social Technology Community welcomes all technocrats to collaborate with like minded people to enhance their tech skills via Ideation, Innovation & Integration.
Import Vendor Files in CakePHP 3
06/29/2016 12:03 pm
 PHP

cakephp 3.jpg


If you have used Cakephp 2x then we know how to import vendor files there. In Cakephp 2x we do the following to import vendor files:

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

In order to load vendor files in Cakephp 3 you need to load the files using require.

Steps to import vendor file:

i) Place library folder under your_project/vendor/

ii) include library file using require_once(ROOT . DS . 'vendor' . DS . "my_library_folder" . DS . "my_library_base_class.php") , this includes the library code file in our code.

Example: Please see the sample example below:

  1. //The following line should do the same like App::import() in the older version of cakePHP

  2. require_once(ROOT . 'vendor' . DS  . 'Twitter' . DS . 'src' . DS . 'twitter.php');

Read the full Blog about Import Vendor Files in CakePHP 3 at Findnerd.


Read such more blogs related to PHP at Findnerd.


0 Comments
Please login to post your comment..
Reach Us
One Commerce Center 1201 Orange Street #600 , Wilmington, Delaware, US, 19899
One Commerce Center 1201 Orange Street #600
Wilmington
Delaware
19899
US
Quick Contact