Alex Bowers: Writing a Hello World PHP 7 Extension

In a recent post to his site Alex Bowers shows you the steps involved in creating a "Hello World" PHP 7 extension with some basic output functionality – basically just echoing out a message.

He jumps right into the code and shows you how to:

  • set up the directory and initial files for the extension
  • write the test case first (a simple PHP file checking if it’s loaded and can be used)
  • updating the config.m4 to allow for enabling the extension
  • the code for src/hello.h to define the function

The final piece is the code in the src/hello.c – the C code to define some structure for the PHP interpreter to understand and be able to execute the PHP_FUNCTION(hello_world). Finally he shows how to make the extension to install it, add it to your php.ini file as a shared module and re-run the test.

Laravel News Podcast: Episode #13 – Chrome Extension for Tests, Jigsaw, Fixing MySQL Memory & More

The Laravel News Podcast has released their latest episode, Episode #13 hosted by PHP and Laravel community member Eric L. Barnes.

In this episode, we talk about Laravel Exception Reporter, Chrome Bandwidth limiter, Chrome extension to generate Laravel tests, Jigsaw, Helpspot Vault, Fixing MySql Memory, Sparkwatch, and Taxes.

You can listen to this latest episode either using the in-page audio player or by subscribing either through iTunes or their RSS feed.

Antonios Pavlakis: Having a go at creating a Behat 3 extension

In this post to his site Antonios Pavlakis "has a go" at creating an extension for the Behat (v3) testing tool. Behat is a testing tool written in PHP that helps with behavior-driven testing as opposed to unit testing with a tool like PHPUnit.

Ever since I got accepted to do a tutorial on Test legacy apps with Behat at the PHPNW15 conference, I’ve been meaning to look into creating custom extensions for Behat. I didn’t have enough time to research into this while preparing for the tutorial, so left it in my todo list in Trello.

During the PHPNW15 long weekend (Friday – Monday), at some point over lunch I was at the table where Matt Brunt (@themattbrunt) and Ciaran McNulty (@ciaranmcnulty) were having a conversation about this and Ciaran said (paraphrasing) “In order to be able to write an extension, you really need to understand how Behat works.”

So a few months later, sleeves up and I went into my vendor/bin/behat and started looking (and poking) around.

After looking in to two current extensions he started to get a feel for what was needed and the pieces that made up an extension. He then gets into detail on each of these pieces and shares some code/configuration he used to create the extension. How to Create a PHP C Extension to Manipulate Arrays Part 2: Adding ArrayAccess and

Dmitry Mamontov has posted the second part of his "How to Create a PHP C Extension to Manipulate Arrays" series on PHPClasses, building on part one and adding in the ArrayAccess and Traversable interface functionality.

In the first part of this article we learned how to create an extension for PHP written in C to create a class that works like arrays. However, to make the class objects really behave as arrays you need to implement certain interfaces in the class.

Read this article to learn how to make a PHP class defined by a C extension implement ArrayAccess and Traversable interfaces, as well understand how to solve problems that you may encounter that can make your extension slower than you expect.

He takes the class he defined in part one and walks you through the addition of the two interfaces. He shows you where they’re defined in the PHP source, what the code looks like and how they integrate with the class. He also shows you how to customize the object class handlers, making it possible to use the custom class (object) as an array. Adding Traversable is easier, adding an iterator return method that allows for the data internal to the class to be iterated through.

Martin Sikora Blog: Google Chrome Extension: PHP Ninja Manuelle

In einem neuen Beitrag heute Martin Sikora hat weist darauf hin, eine Google-Chrome-Erweiterung , die er geschaffen, mit dem Sie einige der Grundlagen der PHP-Handbuch, ohne den Browser.

Schließlich gab ich meine Erweiterung für Google Chrome genannt PHP Ninja Handbuch (Ninja – weil ich Avinash Kaushik ’sBlog und er immer anrufen Menschen, die sehr geschickt in etwas so sind“ Ninjas „). Ich war immer faul, um PHP-Dokumentation zu öffnen jedes Mal musste ich auf einige Methoden-Definition und seine Parameter aussehen, damit ich diese Erweiterung, die eigentlich offizielle PHP Manual sofort in einem Popup-Fenster ist preparsed gemacht.

Sie können sehen, einen Screenshot davon in Aktion hier , einschließlich der auto-complete Suchen und das Beispiel der Funktion Übersicht Details. Wenn Sie es ausprobieren und eine Rückmeldung, gehe über zu das Forum für sie und einen Kommentar hinterlassen.