What do you use for automatic PHP docs generation.
I know about phpdocumentor. but it looks like it didn't have a single release within 2010.
Should I just use it or are there any alternatives?
You can try using DocBlox, a Documentation Generation application inspired on phpDocumentor.
Please see http://www.docblox-project.org for the website and/or http://demo.docblox-project.org/default for a demo.
We use Doxygen at work, but I must confess that I haven't used them much since setting it up in our continuous integration server. NetBeans and other IDEs parse and display the docs when you hover over and auto-complete items.
PHPdocumentor 2 is currently in alpha phase but still usable, so it seams that the project development ist continued.
Related
Is there any way to minify (or remove comments) in PHP using Visual Studio 2015? I use PHP Tools and when i release php scripts to public server, i would like at least remove all comments from code. I know, is there way to remove comments with content menu, but i wish to have comments in my project and no comments (or minimal and unread code) in publish scripts (some like Bundler & Minifier tool, but for php). Thanks
There is basically no point in minifying Php since there is no performance gain in doing so. Although if you insist, there are a few ways to remove comments/whitespaces from source. (and these are not limited to just VisualStudio) -
Use Gulp.
Use Command line options: php -w file.php => generates file without comments & whitespaces. Equivalent to php_strip_whitespace()
Use Regular Expression in Find-Replace Function of your IDE. You can use the following inside Find FieldBox. (and keep Replace fieldbox empty)
//.* or /.
Use a Library/tool like Php-Minify
Hope that helps!
Why aren't you going to use online tool to do it?
There are many online tools you can use instead of VS 2015.
Here is one tool for you.
http://beta.phpformatter.com/
Hope it helps you and check this answer as solved if it helps you.
Thanks!
You can check Comment Remover tool to remove all the comments from a file with a single button click. It also remove #regions and preserve XML Doc comments.
I think there is no tool for visual studio to do this. But you may use external tools to do the job. It's a common task to do this in build system like jenkins. The build system e. g. is able to react on many version control events.
But I also think that you want to make php code unreadable (like compiling). There are only a few options to hide your php code to other people. You could use ionCube for encrypting php files. But then you have to make sure, that the ionCube extension is also installed on the public web server. Also, ionCube is currently not available for php 7.2, only up to 7.1. Another option is to compile php code using HipHop, a PHP to C++ compiler engine: https://de.wikipedia.org/wiki/HipHop
i'm pretty new to php development and want to start using an IDE with syntax checking and autocompletion.
I'm used to programming java with eclipse and thought that the PDT provides similiar functionality.
In java if i type in for example: "new Arr" and press ctrl+space autocomplete suggests a list of possibilities with "new ArrayList()" on top.
but if i try the same in a php project, for example with "new mysq" and ctrl+space i get nothing. I would expect to get "new mysqli()" or similar recommended.
Is the described functionality not included in PDT? Or did i configure something wrong?
I did the "right click on project-> configure-> Add php support" but it didn't change anything.
If you would like to have some basic auto complete feature you can use NotePad++ (download) for a quick and easy starter. This is a really great minimal program that can be used very efficiently to code in many different languages. It provides huge ammount of different functions. It is a must have tool for any developer.
I used Notepad++ to write ten thousands of lines of PHP code, it worked really great for me.
Otherwise PDT also supports autocomplete. Make sure that you have a PHP project added and then your are in a PHP file (.php extension). If you have Java autocomplete working in the same project then I think that you are in a Java project, try adding a PHP project, then a new PHP source file. Then PHP autocomplete should be working well in this source file.
Make sure also that you have PHP perspective selected.
I hope you can get by now starting using PHP! Have luck and good times using this great language!
I found the solution in this question: Why does Eclipse code completion not work on some projects?
I had to manually add this:
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
to the buildpath file of my project.
Problem
I have a legacy codebase I need to analyze and determine dependencies. Particularly the dependencies on classes (internal/external) and extensions (Memcache, PDO, etc).
What I've Tried
I have reviewed the tools listed in Is there a static code analyzer for PHP files?. Unfortunately, this post is dated and most of the promising tools like phpCallGraph no longer work.
My thought was to analyze the code lexically and look for class tokens. Reviewing a list of these would at least allow me to visually determine dependencies. However finding OtherClass in the following code may be complex:
$classname = 'OtherClass';
echo $classname::doubleColon();
In the end, I doubt I'm the first to need this. I'm sure a tool or combination of tools exist to provide what I need. So I'm asking the SO community before writing this myself.
Update
Ideally this tool will analyze multiple files with complete code coverage. As such, tools like Xdebug, while great, are not solutions to this exact problem.
Instead of phpCallGraph you could use Gopal Vijayaraghavan's inclued extension which in combination with Graphviz gives you a nice looking graph of all included files for a certain execution path.
Example:
Moreover, I'd recommend Xdebug (a PHP debugger) which offers a profiler that outputs data consumable by Valgrind. Use the debugger with a compatible IDE to follow the execution path (which helped me a lot to wade thru e.g. Drupal's massive call-stack).
Combine both and you should get a fairly thourough overview.
EDIT
Searched the web and found nWire for PHP - an eclipse plugin that looks like it could be the right tool for you (30 day free trial which should be enough to give you a head start).
I think PhpCodeAnalyzer is exactly what you're looking for - https://github.com/wapmorgan/PhpCodeAnalyzer
It print list of all used external extensions in code base.
any good open source/commercial PHP testing tools available??
I don't know exactly what do you want to test but here are some tools which help during development:
PHPUnit for unit tests
CodeSniffer for coding standards
PHP Mess Detector for code quality
For testing a web application within your web browser automatically try Selenium.
I can also recommend FirePHP with will enable you to debug your code using the Firebug plugin for Firefox.
A list of PHP Performance Test Tools in this link http://scriptime.blogspot.in/2014/07/performance-test-tools.html
Check out PHPUnit:
http://www.phpunit.de/
One especially handy tool to debug is xdebug. Install through PECL. Integrated with your IDE you'll be able to interactively step through code. Without the IDE and it'll prettify your errors and help you test them.
For automatically testing the app itself, Selenium seems to be the best choice. Note that I don't use it, but it will automatically simulate going to a page, filling in data on a form, etc. It's basically a way to automate users' activity in a browser.
The other suggestions are all apt as well.
To test the code you should write unit tests. This requires two tools, what you need is a debugger (xdebug or zend debugger) and phpunit. They can be written in any editor. If you haven't done this before here is an intro article.
http://devzone.zend.com/article/2772
To test the output of the code (HTML,CSS,JS) you should use a different tool. A GUI testing tool is what you use for this job. Here is a list of these tools. Selenium and Selenium based tools is probably the way to go, but the best decision depends on the company and lack thereof.
http://en.wikipedia.org/wiki/List_of_GUI_testing_tools
Do you mean a site where you can run PHP code in order to test it? Like localhost?
OK, I'll give you an answer without the smarm :-).
Here, get started with XAMPP http://www.apachefriends.org/en/xampp-windows.html. I don't know of any in-browser PHP testing methods, and I can (off the top of my head) think of several ways that a good coder might exploit a site that uses eval() to run user-submitted code. They'd basically be giving anybody free range to run code on their server. But look...get started on XAMPP and there you can start testing PHP scripts without even needing an internet connection. Also if you're interested in a good PHP beginner's guide, see here:
http://www.tuxradar.com/practicalphp
Not sure if this is for debugging or for testing but i found WAMP to be a good alternative to XAMP. Thats what i use for testing
does netbeans include phpdocumentator so you can comment your code?
is there some guide on how to use it, eg. how should i comment, how to read them and how to print them out?
It doesn't, but this link contains step-by-step instructions for setting it up.
https://blogs.oracle.com/netbeansphp/entry/generating_php_documentation_from_netbeans
I think the actual PHPDocumentor tool can be installed from PEAR. I doubt it would be included with Netbeans. I imagine Netbeans provides a way to make use of that facility once installed.
The IDE's ability to interpret your docblocks is built in to NetBeans and Eclipse, and probably other IDEs. That's not phpDocumentor working for you (but close I suppose).
Having phpDocumentor installed would mean having the ability to generate API docs from your code and its docblocks.