First of all, package paths must be registered in order to be used with App::uses
, and Lib/Fpdf
is no such one, by default only the core packages are registered.
You could either extend the paths for an already existing package, in your case that would be Lib
:
App::build(array('Lib' => array(APP . 'Lib' . DS . 'Fpdf' . DS)));
And then use App::uses('FpdfWrapper', 'Lib');
http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#adding-paths-for-app-to-find-packages-in
or better add a new package:
App::build(array('Lib/Fpdf' => array(APP . 'Lib' . DS . 'Fpdf' . DS)), App::REGISTER);
http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#add-new-packages-to-an-application
Then you can use App::uses('FpdfWrapper', 'Lib/Fpdf');
And last but not least, of course the filename must follow the CakePHP conventions as already mentioned by @Nunser, ie fdpf_wrapper.php
must be renamed to FdpfWrapper.php
fdpf_wrapper.php
toFpdfWrapper.php
and try with justApp::uses('FpdfWrapper', 'Lib');
? Also, I'm sure you've read this, but couldn't it be an error with the file (syntax, logic, etc) instead of cakephp not finding the class? If that doesn't work, can you be more specific and tell what fails everytime and how?Class not found error
or something else? – HeavensentApp::import('Vendor', bla bla);
. Not sure whether Vendor or Lib is the most appropriate place for this. – Neoteric