Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
PHP Fights HHVM and Zephir with PHPNG
May 27, 2014 @ 15:14:23

In a new post to the SitePoint PHP blog Bruno Skvorc talks about a "fight" that has broken out between various technologies vying to come out as the top PHP performance platform...more specifically the recent PHPNG patch to the PHP language itself.

Chaos in the old world! First HipHop, years ago, and no one bats an eye. Then suddenly, HHVM happens, introduces Hack, and all hell breaks loose - Facebook made a new PHP and broke/fixed everything (depending on who you ask). Furthermore, Zephir spawns and threatens with C-level compilation of all your PHP code, with full support for current PHP extensions. It's mushroom growth time for alternative PHP runtimes, and HippyVM appears as well. Amid the sea of changes, another splash was heard: PHPNG.

He covers some of the basics of the PHPNG patch, who has been working on it and some of the main pros and cons about the refactor. While it does provide a speed boost and native extension support, not all extensions are supported and the internal developers are divided on its adoption.

tagged: hhvm zephir performance phpng introduction

Link: http://www.sitepoint.com/php-fights-hhvm-zephir-phpng/

SitePoint PHP Blog:
Getting Started with PHP Extension Development via Zephir
Apr 09, 2014 @ 15:26:22

The SitePoint PHP blog has posted an introductory tutorial helping you get started with extension development with Zephir, a language that aims to make extension development easy and fast.

This tutorial will explain how to create a PHP extension using a new language: Zephir, which is similar to C and Fortran. You can download the full source code from github. We’ve touched on the concept of Zephir before, so if you’re interested in getting a broad overview, see our previous articles. Zephir can be looked at as a hybrid language that lets you write code that looks like PHP, but is then compiled to native C, meaning you can create an extension from it and come away with very efficient code.

He starts with a list of dependencies you'll need to get an extension compiled and working with Zephir including the gcc compiler and json-c. He shows you how to install Zephir from Github and update your path to make the executable available. As his example extension, he creates a tool that can calculate the result for the time-dependent Schrödinger equation (don't worry, the complete Zephir code for the extension is included in the tutorial). He includes the commands to initialize the Zephir project, code for the various classes involved and the expected output from the compilation. Finally, he includes a bit of PHP code to test out the newly built extension and its output.

tagged: tutorial zephir extension language compile equation

Link: http://www.sitepoint.com/getting-started-php-extension-development-via-zephir/

Simon Holywell:
HHVM vs Zephir vs PHP: The showdown
Mar 03, 2014 @ 18:38:14

Simon Holywell has posted what he calls a "showdown" between HHVM, Zephir and PHP comparing various benchmarks (based on a Mandelbrot Set fractal).

Since its inception the slow running speed of PHP has been widely publicised and over the years there have been a number of improvements. [...] It has become more interesting recently however with three projects looking for improvements in different ways. The core has adopted the Zend OPcache for future versions of PHP, Facebook has been working on a just in time compiler called HipHop VM and the team that brought us Phalcon framework have created Zephir.

All of these projects have chosen to tackle the issue of PHP's speed via different avenues. It has therefore left one simple question - who's making the biggest improvements? Who's the fastest?

He briefly introduces the "contenders" for those not familiar with them and gets right into the benchmarking process. He shares the link to the tests he used and a few notes about the HHVM setup that could account for lower numbers. He shares his results in a few graphs or you can grab the CSV data yourself and parse it. The entire setup is also over on GitHub if you'd like to just check that out.

tagged: showdown benchmark performance hhvm zephir opcache

Link: http://simonholywell.com/post/2014/02/hhvm-vs-zephir-vs-php-the-showdown.html

Padraic Brady:
Zephir Language: Write PHP Extensions The Easy Way (Without C) – Part 1: Introduction
Jan 20, 2014 @ 18:16:44

In the new post to his blog Pádraic Brady starts a series looking at building PHP extensions "the easy way" using the Zehpir language, a derivative of PHP.

When I first heard about the Phalcon framework for PHP, my immediate reaction was to doubt the sanity of its developers. Part of that reaction is something most of us would share: we are not C programmers and that strange alien language sometimes terrifies us. [...] Now, with no padded cell yet in evidence, the Phalcon people decided to do something truly insane. They created an intermediate programming language called Zephir, easily learned by any PHP programmer, that makes creating and maintaining the PHP extensions you do create ridiculously easy.

Zephir is a "bridge" making it easier to create the C code required to build a PHP extension but with the more familiar format we're used to as PHP developers. He includes a simple "Hello World" example and talks about some of the differences between it and PHP. He also briefly talks about some of the things Zephir can't do right now and how it relates to the HipHop Virtual Machine (HHVM) and what advantages it might have over it.

tagged: zephir compile c language series introduction extension

Link: http://blog.astrumfutura.com/2014/01/zephir-language-write-php-extensions-the-easy-way-without-c-part-1-introduction/

SitePoint PHP Blog:
Phalcon 2.0 Alpha Landing
Jan 20, 2014 @ 15:42:37

The SitePoint PHP blog has posted a new article about the latest version of Phalcon (v2.0) and an example of it in use.

I’ve written about Phalcon before, and we’ve got a variety of articles on the framework published already, which is apparent if you just visit the . In fact, not so long ago, I wrote about Zephir, Phalcon’s noble initiative to make building PHP extensions accessible to everyone. Today, a new milestone has been reached by the team, and one that definitely warrants discussion. Way ahead of time, the Phalcon team announced the imminent release of Phalcon 2.0 alpha 1.

He introduces this new version, noting that this is a full rewrite of the framework in a new language, Zaphir (a derivative of PHP). He then gets into using Zephir to make an example extension, complete with a screencast and sample code. He finishes off the post with some information about how you can contribute back to the project and help increase its test coverage.

tagged: phalcon alpha extension zephir version release example

Link: http://www.sitepoint.com/phalcon-2-0-alpha-landing


Trending Topics: