News Feed
Sections




News Archive
feed this:

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

Community News:
Gophp7-ext Project
February 27, 2015 @ 12:39:00

The GoPHP7 project has posted their initiative to try to improve the world of PHP for extensions and make them "first class citizens of the PHP community".

The goals of gophp7(ext) [are to]: get PHP extensions running "out of the box" when PHP7 is released (no lag time), make extensions in general easier to install and use (binaries, ppas), get more people involved in extension maintenance (and travis/appveyor running on them all, killing off bugs), get more documentation written for extension writing and codify some of the "best practices" of extension writing and design (a la PSR).

They're asking for help from anyone interested, even if you don't know C (what PHP extensions are written in). The project asks for just 30 minutes a day to help achieve their goals. The page also lists out the different ways you can help including cataloging the work that needs to be done on the catalog page and working on the development systems for PHP7 to make working with the extensions easier.

0 comments voice your opinion now!
gotphp7 extension project involvement community

Link: http://gophp7.org/gophp7-ext/

Zend Blog:
Developing a Z-Ray Extension
February 25, 2015 @ 11:54:41

Zend recently introduced their Z-Ray inspection tool that allows you to see inside your application and know what's happening in your code, your database and has support for major PHP projects. In this new post to their blog they show you how to develop a custom extension for the Z-Ray system.

One of the coolest features in Z-Ray is the ability to plug in your own extensions. Meaning, you can customize existing Z-Ray panels or add your own personalized Z-Ray panel for displaying information you think is important for developing your specific application. This short tutorial will describe how to write a basic extension for Z-Ray. More specifically, we'll be writing a Z-Ray extension for WordPress that extracts and displays a list of loaded WordPress plugins.

They give you a list of things you'll need to set up before you can get started including a simple WordPress installation on a Zend Server instance. With these in place they help you create the "zray.php" file to define the extension, how to enable it and setting up a "trace" on a function to hook it into the execution. They then dump the WP plugin information and reformat it a bit to show only the list of names and versions in the output panel. As a last touch, they add a logo to the panel to show in the bottom menubar with the WordPress logo.

0 comments voice your opinion now!
zray zend extension custom wordpress tutorial plugin

Link: http://blog.zend.com/2015/02/25/developing-z-ray-extension

Liip Blog:
New Relic extension for HHVM updated to latest version
January 20, 2015 @ 10:04:14

In his latest post to the Liip blog Christian Stocker points out that the New Relic extension for HHVM has been updated for the latest versions of HHVM to work a bit more seamlessly.

Since HHVM 3.4 it's theoretically possible to have your own external profiler for function level profiling (like xhprof or xdebug) without having to recompile HHVM itself. Unfortunately it wasn't perfect (or I couldn't make it running), but there's a patch in the master branch now (the upcoming 3.6), which seems to solve that problem. So I worked a little bit on my extension in the last few days and I adjusted a lot of things and improved some other stuff.

He talks about the improvements New Relic has made on their functionality and some slowness that still exists in the "hotprofiler". He points out, however, that if you just want overall statistics and not specific, method level ones, you don't really even need to use it. He offers a word of caution when using his extension and when it may fall back to "userland level profiling" instead.

0 comments voice your opinion now!
liip hhvm newrelic extension update version release

Link: http://blog.liip.ch/archive/2015/01/19/new-relic-extension-for-hhvm-updated-to-latest-version.html

SitePoint PHP Blog:
The PHP 7 Revolution Return Types and Removed Artifacts
January 19, 2015 @ 13:12:14

On the SitePoint PHP blog today Bruno Skvorc has written about the PHP 7 revolution and some of the changes coming with this next major version of the language (including return types and the removal of some functionality).

With the planned date for PHP 7's release rapidly approaching, the internals group is hard at work trying to fix our beloved language as much as possible by both removing artifacts and adding some long desired features. There are many RFCs we could study and discuss, but in this post, I'd like to focus on three that grabbed my attention.

He touches on a few topics in the post including:

  • the debate that came up about PHP 5.7 versus PHP 7
  • The addition of return types from functions/methods
  • The removal of PHP4 style constructors
  • Changes to the extension API

Obviously, since PHP7 is no where near release status, all or some of these things could be subject to change. For example, the removal of PHP4 constructors is still being hotly contested on the php.internals mailing list at the time of this post.

0 comments voice your opinion now!
php7 revolution returntype remove php4 constructor extension api

Link: http://www.sitepoint.com/php-7-revolution-return-types-removed-artifacts/

Joe Watkins:
Mocking PHP
January 19, 2015 @ 12:23:39

In his latest post Joe Watkins talks about mocking PHP. No, not making fun of the language but rather mocking internal PHP functions and methods as a part of unit testing your application.

I work on a vast PHP code base, it is 3M LOC of PHP alone. It's somewhere between legacy and modern, work is ongoing. [...] When I joined the current project there were many many tests, they relied upon the kind of unholy magic that runkit allows you to perform, for the most part this worked okay for a while. However, runkit inexplicably caused many of the tests to fault, either at shutdown, or at random.

[...] So we were in a bit of a jam, I've always found runkit to be quite awkward, and now I'm staring its source code in the face knowing it represents a road block to my goal of running the latest stable versions of PHP, with the first decent optimizer that ever existed for Zend. I tackled the problem with code, code which I was allowed by my gracious employer to open source (the uopz extension).

He goes on to talk about what the actual root problem he was trying to solve was (dodging code with built-in functions), the "obvious" way to solve it using runkit or the more modern solution that uses the uopz extension. He provides an example of it in use mocking the fopen function with a "uopz_function" wrapper.

0 comments voice your opinion now!
mock internal method function extension uopz unittest

Link: http://blog.krakjoe.ninja/2015/01/mocking-php.html

Laracasts:
Laravel 5 and Behat BFFs
January 13, 2015 @ 10:35:27

The Laracasts site has a new screencast posted showing you how to integrate Behat with Laravel for functional testing of your application. Behat is an automated testing tool, written in PHP, that's made for frontend functional tests rather than backend, unit tests

It has always been a little tricky to hook Behat into Laravel. But, luckily, that's no longer the case. In this lesson, from scratch, we'll install both Laravel 5 and Behat 3, and then learn about using a special extension to make working with the two that much easier. In a follow-up lesson, we'll move on to discussing general BDD, and best practices for constructing your feature files.

You can watch the screencast on the Laracasts site and you can find out more about Behat from its documentation.

0 comments voice your opinion now!
laracast laravel behat functional testing extension tutorial screencast

Link: https://laracasts.com/lessons/laravel-5-and-behat-bffs

SitePoint PHP Blog:
Developing PHP Extensions with C++ and PHP-CPP Advanced
January 08, 2015 @ 11:17:47

On the SitePoint PHP blog today Taylor Ren continues his look at using the PHP-CPP library to help build custom extensions. In this latest post he sheds some light on some more advanced topics.

In my earlier articles, I have introduced the PHP-CPP lib to create an extension for PHP using C++ (first article and second article). In the latter, I demonstrated a bit of the OO side of writing a PHP extension with a Complex class doing complex number manipulations. That introduction is not complete as the main focus of that article is more on the demonstration of the OO capability of PHP-CPP, not on the OO implementation details. In this article, we will further drill down the Complex lib development, adding more member functions, and addressing some advanced topics in writing a PHP extension with OO features using PHP-CPP

He breaks up the advanced topics into sections, providing code examples for each:

  • Returning this pointer in C++
  • Returning a Complex object pointer
  • Exposing the __toString magical method
  • Chaining member function calls
  • Exception throwing and handling in PHP

With the code in place, he then shows how to test all of the new functions you've added with a bit of simple PHP code.

0 comments voice your opinion now!
tutorial advanced extension cplusplus phpcpp series part3

Link: http://www.sitepoint.com/developing-php-extensions-c-php-cpp-advanced/

Rob Allen:
Overriding the built-in Twig date filter
December 16, 2014 @ 09:45:31

In his latest post Rob Allen shows a way you can override the default Twig date filter with your own custom Date extension handling.

In one project that I'm working on, I'm using Twig and needed to format a date received from an API. The date string received is of the style "YYYYMMDD", however date produced an unexpected output. [...] This surprised me. Then I thought about it some more and realised that the date filter is treating my date string as a unix timestamp. I investigated and discovered the problem in twig_date_converter.

He includes some example code you'll need to create the custom renderer. As part of the internals of how Twig formats the date currently is internal and can't be changed, he opted to override the extension itself. As a result, the call to the filter is exactly the same as before, the output results are just formatted more correctly.

0 comments voice your opinion now!
twig override default date filter custom extension

Link: http://akrabat.com/php/overriding-the-built-in-twig-date-filter/

SitePoint PHP Blog:
How to Install Custom PHP Extensions on Heroku
September 29, 2014 @ 14:24:56

The SitePoint PHP blog has a tutorial posted for the Heroku users out there showing you how to install custom PHP extensions on the service as a part of your deployment. Heroku is a platform-as-a-service hosting provider that allows for flexibility in the architecture of your systems and spin up/tear down to happen easily and on demand.

In this tutorial, we'll learn how to install custom extensions on Heroku. Specifically, we'll be installing Phalcon.

He walks you through creating an account on Heroku first and getting the Heroku toolbelt system installed for your operating system. He then starts in on the Phalcon (a C-based PHP framework) installation including all needed supporting packages/extensions. He uses the PHP buildpack and creates a shell script that is executed when the deployment happens. He includes the commands and configuration to handle the deployment and test the resulting installation.

0 comments voice your opinion now!
heroku tutorial custom extension phalcon deploy paas

Link: http://www.sitepoint.com/install-custom-php-extensions-heroku/

Lorna Mitchell:
Compiling PHP Extensions
August 29, 2014 @ 09:28:42

Lorna Mitchell has posted a quick guide to compiling PECL extensions to her site today. This is for those users on unix-based systems that might need to manually compile with some custom options (or may be working on your own extension and may just need to test it).

There are lots of reasons why you might like to compile your own PHP extensions. [...] I haven't seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn't particularly tricky so here is my quick how-to guide.

The process is relatively simple for those familiar with the command line and the steps involved in compiling software. There's some special PHP-only steps you'll have to take before compiling the code to make sure it's ready to be a PHP extension. Then it's up to the usual configure+make_make install to ensure the .so file is correctly generated.

0 comments voice your opinion now!
compile extension tutorial phpize module

Link: http://www.lornajane.net/posts/2014/compiling-php-extensions


Community Events

Don't see your event here?
Let us know!


podcast wordpress extension voicesoftheelephpant language library development unittest middleware community release laravel introduction conference api laravel5 framework series interview opinion

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework