I'm searching for a PHP syntax highlighting engine that can be customized (i.e. I can provide my own tokenizers for new languages) and that can handle several languages simultaneously (i.e. on the same output page). This engine has to work well together with CSS classes, i.e. it should format the output by inserting <span>
elements that are adorned with class
attributes. Bonus points for an extensible schema.
I do not search for a client-side syntax highlighting script (JavaScript).
So far, I'm stuck with GeSHi. Unfortunately, GeSHi fails abysmally for several reasons. The main reason is that the different language files define completely different, inconsistent styles. I've worked hours trying to refactor the different language definitions down to a common denominator but since most definition files are in themselves quite bad, I'd finally like to switch.
Ideally, I'd like to have an API similar to CodeRay, Pygments or the JavaScript dp.SyntaxHighlighter.
Clarification:
I'm looking for a code highlighting software written in PHP, not for PHP (since I need to use it from inside PHP).
Another option is to use the GPL Highlight GUI program by Andre Simon which is available for most platforms. It converts PHP (and other languages) to HTML, RTF, XML, etc. which you can then cut and paste into the page you want. This way, the processing is only done once.
The HTML is also CSS based, so you can change the style as you please.
Personally, I use dp.SyntaxHighlighter, but that uses client side Javascript, so it doesn't meet your needs. It does have a nice Windows Live plugin though which I find useful.
Why not use PHP's build-in syntax highlighter?
http://php.net/manual/en/function.highlight-string.php
[I marked this answer as Community Wiki because you're specifically not looking for Javascript]
http://softwaremaniacs.org/soft/highlight/ is a PHP (plus the following list of other languages supported) syntax highlighting library:
It uses <span class="keyword"> style markup.
It has also been integrated in the dojo toolkit (as a dojox project: dojox.lang.highlight)
Though not the most popular way to run a webserver, strictly speaking, Javascript is not only implemented on the client-side, but there are also Server-Side Javascript engine/platform combinations too.
PHP Prettify Works fine so far, And has more customization than highlight_string