What is the best way to use XSLT 2.0 with PHP? - php

This is my second question on the site, like always, I've spent several hours reading a lot of related questions, the 2 most relevant are:
Will XPath 2.0 and/or XSLT 2.0 be implemented in PHP?
Which explains a solution using PHP/Java Bridge and Saxon.
And
Upgrade PHP XSLT processor to XSLT 2.0
Which explains a solution using XML_XSLT2Processor, installing it with PEAR and PHP.
I focused mainly on the second option since php already have a XSLTProcessor library, but sadly it only supports XSLT 1.0 and I'm looking 2.0 support, so it seemed to be the right option, but after installing PEAR and trying to install XML_XSLT2Processor, and reading many articles(1, 2, 3, the ones I currently have open about the topic) and AltovaXML gone commercial, and PEAR being so buggy, I decided to go with the first option.
But I don't really know Java, yet I'm gonna give it a try, but before starting with this I decided to ask first (plus the posts are a little outdated).
Isn't there any other better way to manage XSLT 2.0 with PHP?

The question is timely because last week we launched Saxon/C, a port of Saxon compiled to Intel machine code with APIs for C, C++, and PHP. It's early days yet (an Alpha 0.1 release), but if you don't mind being at the bleeding edge, you might give it a try. And of course we welcome your feedback. Details at http://www.saxonica.com/saxon-c/index.xml

Related

Why is Google App Engine Standard using PHP 5.5?

I plan on hosting PHP applications in Google App Engine Standard, but i find one thing quite concerning:
Currently one can choose between a PHP 5.5 runtime, and a beta 7.2 runtime. So the currently available non-beta version is 5.5, which had it's End-of-Life 1 1/2 years ago!
Why was this not upgraded to 5.6 long ago? why are there no 7.0 or 7.1 environments (7.0 came out 2 years ago!)? Isn't it completely irresponsible to provide such an old PHP runtime? I mean even the most amateurish shared hosting companies probably have upgraded to 5.6 long ago. I can't understand, why Google - one of the leading Tech-companies on the planet - is doing this.
I know that i can use any runtime i want in the flexible App-engine, but if "Standard PHP environment" is interpreted as PHP 5.5 by Google, isn't this a giant red flag for any developer? Why would anyone be so irresponsible to use PHP 5.5 nowadays or choose a hosting provider, that is THAT far behind, that it provides 5.5 as the most current stable PHP environment? Isn't such an incredibly conservative and seemingly irresponsible upgrade-schema of runtimes a big red flag NOT to use App Engine Standard for any responsible dev?
Or am i completely missing something here?
In the first generation standard environment sandbox a lot of the services relied on specially crafted libraries, APIs and supporting infrastructure/services.
Most likely many/all of these would need to be re-written/ported by the GAE team when changing the supported language version and doing so in a timely and cost-effective manner while maintaining the SLAs is not at all trivial.
You can see a list of these services in the Migrating Services from the Standard Environment to the Flexible Environment guide - most if not all of them aren't available in the 2nd generation standard environment either.
By replacing these services with more or less similar solutions offered by other Google (or even 3rd party) teams (or dropping them altogether) adding support for different languages/versions became a lot easier - probably explaining the constantly increasing rate at which these came to life and evolved - see An Annotated History of Google’s Cloud Platform and/or the PHP Release Notes. Which is, if you want, proof that Google kept actively trying to keep up with language evolution.
I'm not sure about PHP or the other languages, but for my app usage context I'm more than happy with the older python 2.7 version, especially when taking into account the other advantages exclusively offered by the 1st generation standard environment. I just hope that with the alternate offerings in place the cost of maintaining it (even frozen as-is) remains low enough to not justify discontinuation ;)

Is Cassandra-PDO for PHP stable?

I'm new to Cassandra and I'm looking for the best way to integrate it with PHP.
As always there are many clients but it looks like most of them are not being supported. From what I've seen the most up to date is PHPCassa, unfortunately it doesn't look like it was designed for CQL (which as I understand is the preferable way to talk to Cassandra).
Cassandra-PDO looks interesting because it's using PDO abstraction, and I can (probably?) use high level libraries like Doctrine or Propel with it. Unfortunately the last commit was pushed about 2 years ago and it was very difficult to compile it (to be fair, it was probably a Mac / Thrift issue). I'm always very paranoiac about building something around "rusty" projects, so my question is:
Is it safe to use Cassandra-PDO with Cassandra 2.x? If it's not a good idea should I forget about CQL and go for PHPCassa or perhaps there is another solution?
This might help: https://github.com/Orange-OpenSource/YACassandraPDO
"This repository is a fork of:
https://code.google.com/a/apache-extras.org/p/cassandra-pdo/ We cloned
it on GitHub because the original project seemed to be dead.
This version is developped for the CQL3 target only. We do not provide
any support for former versions of CQL."
HTH,
Carlo
To my knowledge YACassandraPDO not stable.
Please check this PHP library http://evseevnn.github.io/php-cassandra-binary/
It is written by me, and how to work with it is similar to the PDO wrapper. Maybe it will suit you.

Facebook HipHop virtual machine for PHP?

I've looked at this article- HipHop PHP (was Hyper PHP by Facebook)
However, recently come across this Facebook Speeds Development With “HipHop Virtual Machine”, A 60% Faster PHP Executor
Does anyone have details on this? Is it worth exploring for a PHP developer?
You can find the details in the article linked in the article you linked:
https://www.facebook.com/notes/facebook-engineering/the-hiphop-virtual-machine/10150415177928920
hphpc is in essence a traditional static compiler that converts PHP→AST→C++→x64. We have long been keenly aware of the limitations to static analysis imposed by such a dynamic language as PHP, not to mention the risks inherent in developing software with hphpi and deploying with hphpc. Our experiences with hphpc led us to start experimenting with dynamic translation to native machine code, also known as just-in-time (JIT) compilation. A dynamic translator can observe data types as the program executes, and generate type-specialized machine code.
The type-specialized machine code runs faster. Unless you are the size of FB, you do not need this. Use APC or memcached and more traditional approaches to scaling out.
The other answer about HPHPC is accurate... the performance boost is quite nice, but only if you actually need it enough that it's worth the extra complexity.
I'd suggest waiting a few weeks or even months before looking into HPHPVM. It's looking promising, but it's still in the very early stages as far as optimization and bug-fixing go. In the long run it'll probably end up being a great alternative to Zend, but right now the relatively small boost in performance (compared to, say, full translated/compiled HipHop) is likely not worth the extra complexity. That said, do check back in a few months.

Is phpDocumentor dead?

Or is it just at a 'finished' state? I've used PHPDoc for many years on all my PHP projects, but I recently noticed that the last post on the PHPDoc website was from 2008. So I'm wondering if it's time to look into other alternatives like Doxygen. Are there any advantages to using something other than PHPDoc?
EDIT: Interesting post on Dev Zone today when Matthew announced the release of Zend Framework 1.11.5 he wrote:
"Mike van Riel offered to convert our API documentation generation to DocBlox. We'd already been considering it for ZF2, but on seeing the flexibility of the templating system, and, more importantly for us in terms of packaging, the speed and minimal resources it utilizes in generating the output, we were sold. (API documentation generation time was reduced from taking 80-100 minutes to less than 10.) You can view the results for yourself." http://devzone.zend.com/article/13643
This is why I'm concerned, if large projects like Zend Framework are dropping phpDoc, it seems to me the inactivity of phpDoc is not going unnoticed. 100 minutes down to 10..that's what I like to hear.
#gms8994 good call
*UPDATE: So turns out DocBlox is PHPDocumentor2 in disguise/re-branded. http://www.docblox-project.org/
Although I currently use doxygen, too, I have to post that PHPDocumentor is not dead. Instead the attempts made by the DocBlox project are joined to form the basis for PHPDocumentor2 which sports a brand new website. These days I'm not convinced it's production ready but it does already look really promising.
I have recently used Doxygen for generating documentation for PHP.This is open-source tool for documentation and support other languages too.I would say this is a good tool and it easily generate documentation as well as class diagrams and have lots of configurable features.It is available for Windows as well as UNIX/LINUX
Can Find the latest release and DOWNLOAD Here
Why fix something that isn't broken? PHPDoc works great, doesn't need anything else really. They're not trying to innovate, just to help create documentation. Which they did, very well.
I had several problems with phpDocumentor. One of them was the xml export. After a few attempts to fix the code I decided to look for an alternative.
What I found and liked was: Rarangi
https://bitbucket.org/laurentj/rarangi/wiki/Home
Rarangi is a generator of documents from php source code.
The interesting thing about it was that it saves the information in a mysql db and you can make your own custom reports.
phpDocumentor v3 (with proper PHP 7 support) is currently alpha, getting real close to a stable release. The problem is that they don't have a lot of people working on it, so development is slow.
I've tested the latest alpha on one of my Symfony projects and it does the job okay, although it's missing some features and has a couple of bugs. They were all reported, of course.
https://github.com/phpDocumentor/phpDocumentor/releases
Update: phpDocumentor v3 just went beta. Check releases.

PHP versions "market share"

Does anyone know where can I find recent data on PHP4 vs PHP5 "market share", that is, what percentage of servers on the Internet have PHP5 installed?
I found this but it's from 2008:
http://www.nexen.net/chiffres_cles/phpversion/18824-php_statistics_for_october_2008.php
I also checked netcraft.com but I don't think they have something like that.
Thanks!
You can find up-to-date statistics in W3Techs: http://w3techs.com/technologies/details/pl-php/all/all
Click on the versions to drill down.
When posting the question I forgot that I can compile my own stats which for me would be even more relevant than some global "market share" data.
I'm selling a PHP script and I have the site urls of the people who buy or trial my software so I can easily do an automated "survey".
Currently the PHP versions supported by the script are 4.3+. The actual distribution of PHP versions, however, got me surprised (pleasantly). Out of 176 sites that I pinged, 7% were running PHP4, 3% - PHP 5.1 and the rest 90% - 5.2.4+, which I think is quite nice for anyone thinking about developing just for PHP5.
Of course, my data may be scewed - my users are mostly based in US and are more tech-savvy than the average. Someone with wider target market may have different results but I think the trend is good :)
Oh, and it's worth noting that from 176 sites, precisely 2 (two) were running Windows even though my software works just fine on it :)
GoPHP5 lists the web hosts and projects that support PHP 5.2+

Categories