phpjs
Version:
68 lines (48 loc) • 2.34 kB
Markdown
# php.js
<!-- badges/ -->
[](http://travis-ci.org/kvz/phpjs "Check this project's build status on TravisCI")
[](https://npmjs.org/package/phpjs "View this project on NPM")
[](https://david-dm.org/kvz/phpjs)
[](https://david-dm.org/kvz/phpjs#info=devDependencies)
<!-- /badges -->
php.js is a resource that offers community-built JavaScript alternatives to PHP functions.
More info at: http://phpjs.org/about
## Npm
```bash
$ mkdir test && cd $_
$ npm install phpjs
$ $EDITOR try.js
```
```javascript
var php = require('phpjs');
php.echo(php.sprintf('Hey, %s : )', 'you'));
php.echo(php.parse_url('mysql://kevin:abcd1234@example.com/databasename')['pass']);
php.echo(php.strtotime('2 januari 2012, 11:12:13 GMT'));
```
```bash
$ node try.js
Hey, you : )
abcd1234
1325502733
```
## Testing
### cli
```bash
make test
```
```bash
node bin/phpjs.js --action test --name sort
node bin/phpjs.js --action test --category array
```
### Web
```bash
PORT=8080 node test/browser/server.js
```
Point your webbrowser to http://localhost:8080
## Sponsor development
<!-- badges/ -->
[](https://www.gittip.com/kvz/ "Sponsor the development of phpjs via Gittip")
[](https://flattr.com/submit/auto?user_id=kvz&url=https://github.com/kvz/phpjs&title=phpjs&language=&tags=github&category=software "Sponsor the development of phpjs via Flattr")
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kevin%40vanzonneveld%2enet&lc=NL&item_name=Open%20source%20donation%20to%20Kevin%20van%20Zonneveld¤cy_code=USD&bn=PP-DonationsBF%3abtn_donate_SM%2egif%3aNonHosted "Sponsor the development of phpjs via Paypal")
[](https://coinbase.com/checkouts/19BtCjLCboRgTAXiaEvnvkdoRyjd843Dg2 "Sponsor the development of phpjs via BitCoin")
<!-- /badges -->