Hey Guys,
As the creator of php.js I can probably shed some light on this.
The frontpage of
http://phpjs.org does some explaining already. To
summarize:
- We really do encourage people to learn JavaScript (in fact we had to
write a whole bunch of it in order to create php.js : )
- In terms of of highlevel functions JavaScript leaves some things to
be desired like sha1, sprintf, and number_format.
But it's been too much of challenge to stop there.
We figured, instead of us deciding what's made public, let's try to
get at least 2 unit tests from the documentation working, and publish
everything with the occasional warning like: "For study purposes." (as
with mentioned usleep).
To compensate for our huge library with functions ranging from useful
to useless, and that varying from person to person, we let end-users
draw their own line with an online compiler:
http://phpjs.org/packages/configure
. "We're all consenting adults here" right? : ) It let's you build
tiny namespaced (yes) packages with just the functions that you need,
and trust. Just take what you need and be on your way. There are
already thousands of different packages out there.
At request by some in the node.js community, we've added CommonJS
support to this compiler
http://twitter.com/commonjs/status/12610285557
so that you can export e.g. just the date or cryptographic functions
under a php_js object.
I realize PHP has been getting a lot of heat lately, and we're used to
taking some of that. Especially in JavaScript-land where programmers
often have different server-side backgrounds, it seems like we are
appointed to defend PHP's fame and glory. Well we're not about to.
What I will say is this: it's API is known to get the job done, just
ask millions of developers. And this huge audience is already familiar
with it's quirks. So when they take our stripslashes (like node.js
itself did at one point), we at least bring no new surprises to the
table.
We realize not all functions are perfect yet, and the skill-level of
contributors varies. But chances are, we have a better
http://phpjs.org/functions/strtotime:554 than you could hack up in a
week (although you are an elite programmer). Just because it's being
tested & improved upon by so many people in different environments.
Reporting problems is as easy as making a comment, and 270 different
authors have shared their code, ideas & solutions.
As with any open source project we try to get better & better using
hard labor, unit tests, and encouraging people to contribute better
code.
If you've taken our htmlentities, indeed discovered issues and
improved it with your own fixes, you should really consider
contributing those back.
Best whishes,
Kevin van Zonneveld
http://twitter.com/kvz