Use PHP functions in JavaScript
Logged in as Guest

Work in progress

This is our new site. Many features do not work yet. You should probably go to Kevin's TechBlog », where active PHP.JS development still takes place.

What's PHP.JS?

PHP.JS is an open source project in which we try to port PHP functions to JavaScript. By including the PHP.JS library in your own projects, you can use your favorite PHP functions on the client-side.

This convenience may speed up development for PHP developers who are increasingly confronted with client-side technology.

It also offers added functionality for scripting, because JavaScript does not natively support higher-level functions such as: file_get_contents(), mktime(), serialize()
It's nothing fancy like jQuery, we're just offering PHP functions, with all of their original flaws and benefits for whomever needs them.

Featured Functions

md5

Generate hashes client side to take load off of your server.

date

Date-formatting, just like you know it from PHP

base64_decode

Safe & easy data transport, decode messages in JavaScript that where encoded by PHP.

The History of PHP.JS

A developer called Kevin van Zonneveld was once working on a project with a lot of client(JS) / server(PHP) interaction, and he found himself coding PHP functions (like base64_decode & urldecode) in JavaScript to smoothen communication between the two languages.

He stored the stored the functions in a file called php.js which was included in the project. But even when the project was done, it remained fun trying to port PHP functions to JavaScript and so the library grew.

Kevin decided to share the little library online, which triggered the enthusiasm of a lot of PHP developers longing for PHP functionality in JavaScript. The project was open sourced in 2008, and many people contributed their own functions in the comments sections of Kevin's blog.

It was decided that the library deserved a bigger home, and a face of its own, and so the PHP.JS core team (which at that time also consisted of Michael White, Felix Geisendörfer, Philip Peterson) developed the phpjs.org website.

News

  • Item 1
News element not yet configured

Download

To include all PHP.JS functions at once, you need one of the following packages. The normal packages are just a collection of standalone functions, making it easy to address them. With the namespaced packages, the functions are contained in one object. Making it easier to avoid naming conficts and to extend, overrule, or modify PHP.JS to your own whishes.

Normal (novice)

Namespaced (advanced)

Who uses PHP.JS

  • vanzonneveld.net

Do you use PHP.JS? contact us and get linked!