Blog Latest Execute PHP Functions In JavaScript with PHP.JS
 
Execute PHP Functions In JavaScript with PHP.JS PDF Print E-mail
Digg!

PHP.JS is a JavaScript library that enables anyone to use PHP functions client-side.

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 client-side.

No server component required. To use PHP.JS you can either:

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

It also offers added functionality because JavaScript does not natively support higher-level functions such as: file_get_contents(), mktime(), serialize().

PHP.JS is 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

Developer 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 on his blog, triggering 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 consisted of Michael White, Felix Geisendörfer, Philip Peterson and Kevin) developed the

phpjs.org website

Different core members have come & gone but there has always been a

select group

pushing the project forward.

Late 2008

Brett Zamir started

contributing and did't stop. In April 2009 he was responsible for over 245 different PHP functions and has had many ideas considering PHP.JS' future.

Because the library became too big to include at once, and having users copy-paste functions to their projects was nothing short of creating a maintenance hell, Kevin started working on a compiler tool that allows programmers to select ONLY the functions they need, and wrap them up in a single php.js file.

This took away overhead and even allowed for easy upgrading.

And that's where we are now.

We are still trying to port and perfect more & more functions.

Want to help out & become a part of PHP.JS history? Why not add a comment with new or better code? It's that easy.

Functions overview

Here is a list of functions currently implemented by PHP.JS. Missing functions can be found here.

Arrays

Character type checking

Class/Object Information

Classkit

Date and Time

Error Handling and Logging

Filesystem

Function Handling

JavaScript Object Notation

Laguage & Control Structures

Mathematical Functions

Miscellaneous Functions

Net Gopher

Network

Object Aggregation/Composition

PHP Options and Information

Regular Expressions (Perl-Compatible)

Strings

URLs

Variable handling

XML Parser

runkit



Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!
 

Jomwitter Twitter Badge

Who's Online

We have 25 guests online

Syndication