Telling PhpStorm about classes in php extension modules (PDFLib)

Hi,

I'm working on a project which involves PDFLib. PDFLib is installed on my computer as php extension libpdf_php.dll and shows up correctly on the phpinfo() page.

My problem now is that I can't get PhpStorm to recognize the class.

$p = new PDFLib();



gives me an "undefined class" warning with all the consequences for subsequent method calls. Is it just me not knowing how to do it right or is there indeed no way of telling PhpStorm about classes defined in php extension modules?

Thanks for any hints.
Bernd

4 comments
Comment actions Permalink

Hi Bernd,

If this library/extension is not supported by PhpStorm already ... then the only thing you can do right now is to create stub file, place it anywhere in a project so PhpStorm will know what all those functions are.

Stub file is basically a PHP file with class/functions/constants/variables/etc definitions (with proper PHPDoc comment blocks) but all function/method bodies are empty -- that's how all classes/functions/etc that are supported by PhpStorm ATM are  implemented.

You can see an example of such files in:


It is possible that such stub file is already created by someone for another IDE or other similar purpose -- maybe it's a matter of finding it somewhere on the Internet...

0
Comment actions Permalink

Hi Andriy,

thanks for taking the time to answer. You pointed me absolutely in the right direction. Meanwhile, I found out that a stub file was already contained in the PDFLib distribution. After insuccessfully trying to update the php.jar file with the stub, I simply placed it somewhere in the project directory. Now developing with PDFLib and PhpStorm is much easier.

Best regards,
Bernd

0
Comment actions Permalink

Hi Bernd,

can you tell me where I can find the stub file?

0
Comment actions Permalink

Hi Madlen,

The file is located in bind/php/Eclipse PDT

Regards,

Valentin

0

Please sign in to leave a comment.