Existing alternate PHPDoctor doclets or styles? - php

We are about to start using PHPDoctor to auto-generate documentation for our PHP codebase at work. (It was the only one we've tried that could handle our very large codebase, and unlike PHPDocumentor, it's still being updated and supports PHP 5.3).
We'd like to try using different doclets and/or stylesheets than the default that come with it. I did some Googling but didn't see where anybody has posted any. Before we make our own, does anybody know a place where they can be found online?

If you do create your own, we'd love to see it and add it into the project if it's something other people would benefit from.

Related

PhpStorm does not recognize PHP

I saw many different questions here, but nothing was helpful to me.
I have no trouble with an interpreter, I tried to reset PhpStorm's cache.
It looks like file functions.php isn't accessible.
I really don't want to make a total reset. Maybe somebody has an idea how to solve it?
I'm not sure what I actually did and how to reproduce this issue again, but now it works well. I took previous version of PHPstorm. When I installed new one, the previous one was simply renamed to sth like 'phpstorm2'.
Here are my thoughts what actually happened:
As I understand for highlighting is responsible that part of application which is managed under Languages & Frameworks / PHP / PHP Runtime.
To reproduce this issue you may try to disable there "Core / Core" and try to write down in any place of your phpfile following:
\Exception::class();
And in your case this class will not be highlighted, as it presents in Core_c.php. In my case it is placed in
/opt/phpstorm/plugins/php/lib/php.jar!/stubs/Core/Core_c.php
I'm 100% sure that these libs were always enabled, but why I didn't saw this - that is the question.
So if I face this issue again my steps would be:
Try to verify Languages & Frameworks / PHP / PHP Runtime. The better way would be to enable ALL libs.
Check External Libraries in the project tree. Check read privileges for /opt/phpstorm/plugins/php/lib/php.jar and probably reinstall this plugin.
Try to find out function which I don't actually see in External Libraries.

How do I use PHP libraries without composer?

This is a really noob question... How do I use PHP libraries downloaded from GitHub? I've never experienced using libraries (even with the use of Composer). Where do I put the library folder? Are there any other steps I need to take to make the library work?
I'm trying to use PHPSpreadsheet to read and write Excel files; in their GitHub documentation, it's only about using the library in code.
I've tried searching for ways on how to use libraries without the use of Composer but they were all really specific and didn't apply to my situation. There were answers about using libraries on a server and about using libraries on Wordpress.
I just need to use the library for my thesis which will just be on one PC, no servers or anything.
A computer is a computer - PHP doesn't care whether it's a server or not. Believe it or not, every answer you saw did, indeed apply to your situation. PHP is a tool - a hammer - and you can use it to drive in nails or put dents in a fender with equal efficiency.
Put the library folder anywhere you like - literally
Then, at the top of every .php file that needs to use the library, simply add:
require '../relative/path/to/library/file.php'
or
require '/absolute/path/to/library/file.php'
It's that easy ... welcome to the wonderful world of code - where EVERY decision you make will come back to bite you on the a** ;)

PHP code analyzer to determine classes/extensions used

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.

Migrating php code from 5.2 to 5.3

I was asked to help getting a website that was running with 5.2 php code, to work on a 5.3 php server. The site is big, and I can't see the errors that would appear normally when a site isn't working.
I've tried to use the Search and replace function that Dream Weaver has, and simply use it all over the website. But the problem is that I only want to replace functions in PHP documents, and not in js files. When i use Search and replace, in Dreamweaver, it overwrites the js files aswell, and that would cause more errors. Because there's A LOT of files that i have to go through, it would take me a lot of time if i had to go through it manually.
I figured this must be a problem that a lot of firms experiance, so there must be ways to handle this without it being a bigger hassle.
Anybody out there who could help me out ? Any help is much appreciated!
Regards,
Mathias
Check out the official guide about Migrating from PHP 5.2.x to PHP 5.3.x
most existing PHP 5 code should work without changes, but make sure error-reporting is enabled to get some idea of what is going wrong .
I would recommend the use of sed from command line. It is most likely the fastest and most powerful find/replace utility available for LAMP developers.
http://www.grymoire.com/Unix/Sed.html
Dont worry about it! If your code works in php->5 for the most part it will work just fine. 5.3 offers a plethora of options but no doubt your not using them.

Hide source code in PHP GTK

i have a peculiar question.
Iam developing a php GTK2 desktop application, and my purpose is to hide the source code from the client, to whom i will handle the desktop application (deploy in his system), once it is completed.
Our motto is to enable the client to run the application, without the need for a browser.
I have heard about tools like ioncube encoder that can encrypt the php source code.
I want the same functionality to be achieved with the GTK application.
Others must not be able to see the source code. How can this be achieved ?
If you want to go the paid for route, ioncube seems good. I've found a nice article that explains this and gives you some options - it seems like Zend has the best solution if you go by price.
http://www.zubrag.com/articles/php-source-code-encoders-and-protectors.php
I hope this helps you.
I have never heard of a good free solution for this.
There is a couple of vendors providing tools to do this. By googling I found this page that presents different solutions:
http://www.seocompany.ca/software/free-encryption-software.html
I think the Alladin usb key encryption system is one of the most robust one, but not free.
And you can also make a copy of your code and remove all comments, use only non-explicit variable names etc, so that even if your customer breaks the encryption, it would still be hard to understand the code...
Hope this helps!
P

Categories