The PHP Script presented here uses PHP's ReflectionClass to obtain the information about the methods and functions of any PHP class, both user-defines or built in, such as mysqli, SPL or PDO. This scrip was written and kindly provided to NuSphere by Hasin Hayder - who gets a million of our thanks.
Nusphere PhpED's PHP Code Completion and Code Insight use the files included in PhpED project to build the database of classes and functions definitions. While all of the user defined classes and functions are parsed and added to PHP Code Insight, some of PHP built-in classes might be missing. Using php-code-completion.php helps to fix that problem easily, because it:
- Uses ReflectionClass to obtain class's name and methods and parameters
- Prints them in such format that the output can be copy pasted to PHP file directly
All you need to do is:
- Substitute the name of the class in '$class = new ReflectionClass("mysqli");'
- Run php-code-completion.php to get the output in PHP Viewer
- Copy and Paste this output in PHP file and make sure that the path to this file is included in the PhpED's Project Properties->Includes tab
Note: due to some defects discovered in Reflection package some arguments of the methods might not print out. This means that Code completion might be lacking these arguments in the pop-up tips, however you can easily add these arguments manually.
The script was tested on PHP 5.2.1.
|