The JavaScript blog.


ui angular php

v8js, Angular Foundation

Posted on .


On Friday I wrote about Uniter, which converts PHP to JavaScript. But what about running JavaScript in PHP? C. Scott Ananian sent in v8js (GitHub: preillyme / v8js, License: MIT), a PHP extension that lets you run JavaScript inside a PHP application.

It has both PHP and JavaScript APIs, so you can do things like var_dump in JavaScript. In the PHP side, you can evaluate JavaScript with $v8->executeString().

This project actually uses V8, and you can restrict JavaScript based on time and memory usage.

Angular Foundation

Angular Foundation

Angular Foundation (GitHub: madmimi / angular-foundation, License: MIT) is a Foundation port of the AngularUI bootstrap project.

We are aiming at providing a set of AngularJS directives based on Foundation's markup and CSS. The goal is to provide native AngularJS directives without any dependency on jQuery or Foundation's JavaScript. It is often better to rewrite an existing JavaScript code and create a new, pure AngularJS directive. Most of the time the resulting directive is smaller as compared to the orginal JavaScript code size and better integrated into the AngularJS ecosystem.

The documentation explains what Foundation components are supported, and shows how to use them as AngularJS directives. The authors created it after they noticed people on Stack Overflow asking about AngularJS directives for Foundation, and finding the existing solutions less complete.


testing games php

Uniter, Chai Webdriver, Gamedev.js Weekly

Posted on .


When we run our yearly survey, I've noticed PHP is popular with our readers. So here's something that you might either love, or consider arcane blasphemy: Uniter (GitHub: asmblah / uniter, License: MIT), a JavaScript to PHP source-to-source compiler:

Uniter allows you to execute PHP in the browser or in Node.js. As an on-the-fly recompiling interpreter (or transpiler) it results in the closest possible translation from PHP to native JavaScript code.

It includes Mocha unit tests and should run in IE 9 or above. It currently supports most of PHP's keywords, and even has basic class support. The demo is interactive, so you can try editing the PHP source to see what happens.

Chai Webdriver

Chai Webdriver (GitHub: goodeggs / chai-webdriver, License: MIT, npm: chai-webdriver) by Max Edmands is a Chai plugin for making markup-based assertions when using webdriver. For example:

// Start with a webdriver instance:
var sw = require('selenium-webdriver');  
var driver = new sw.Builder()  

// And then...
var chai = require('chai');  
var chaiWebdriver = require('chai-webdriver');  
chai.use chaiWebdriver(driver);

// And you're good to go!
chai.expect('#site-container h1.heading').dom.to.not.contain.text("I'm a kitty!");  

It works with Selenium, chromedriver, PhantomJS, and SauceLabs.

Gamedev.js Weekly

Gamedev.js Weekly is a weekly newsletter of JavaScript game-related news. There's an archive so you can preview it before signing up.