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

NetTuts.com:
Programming With Yii2 Integrating User Registration
March 24, 2015 @ 12:27:16

NetTuts.com has posted the next part in their "Programming with Yii2" series today with this tutorial showing you how to integrate user registration into your sample application.

This is part four of a series on Yii2. In Programming With Yii2: Getting Started, we set up Yii2 locally, built a Hello World application, set up a remote server, and used Github to deploy our code. In part two, we learned about Yii's implementation of its Model View Controller architecture and how to build web pages and forms that collect and validate data. In part three, we learned about working with databases and ActiveRecord. In this tutorial, we'll walk you through integrating a popular user registration plugin.

They walk you through the use of the Yii2-User extension to provide the user handling functionality. The tutorial shows you how to get it installed (via Composer), run its database migrations to create the needed tables and where to update the configuration files to pull the plugin into the execution. They also help you set up SwiftMailer (what it uses to send its emails) and then gets into the integration of the registration with the application with a signup page.

0 comments voice your opinion now!
programming yii2 integration user registration yii2user extension tutorial

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-integrating-user-registration--cms-22974

Freek Lijten:
Testing PHP extensions - what makes a good test
March 23, 2015 @ 09:52:58

Freek Lijten has a new post today continuing his look at the world of PHP extensions and focusing in on testing this time. He hopes to answer the question of what makes a good, effective set of tests to help increase the stability and quality of the extensions you write.

In my previous blog I took you through the process of getting PHP and extensions compiled, generating code coverage and running tests. What I did not talk about was what makes a good test. I hope to correct on this by adding this post and going into more detail on the actual writing of tests itself.

Using the same extension as before (enchant) he goes through the addition of a test for the enchant_dict_add_to_session function. He start by showing how much the function is currently tested (hint: none) and code coverage. He points out that 100% coverage is just one metric in a set that should be considered and not the final goal. He shares a simple test for the function that checks to see if a certain word exists in a dictionary. The coverage report shows all lines being executed, but there's a lot not tested, at least conceptually. He shows how to test "the spirit" of the function with additional tests for non-existent words, spell checking and if a word is not in the dictionary at all. PHP example code shows these tests kinds of tests to illustrate the steps he's talking about.

0 comments voice your opinion now!
test extension phpt spirit codecoverage metric goal

Link: http://www.freeklijten.nl/home/2015/03/22/Testing-PHP-extensions-what-makes-a-good-test

Freek Lijten:
Testing and improving PHP extensions for PHP 7
March 13, 2015 @ 10:02:47

In his latest post Freek Lijten talks about PHP extensions, the upcoming PHP version - well, PHP7 - and the things that can be (and are being) done to help improve and prepare the extension ecosystem. In his post he walks you through the process of getting a PHP7 install set up, a sample extension set up and writing some tests to help improve it.

PHP7 is coming. And it is coming to a neighbourhood near you :) A couple of people started an initiative to ensure extensions will be running out of the box once PHP7 hits the shelves. The fun part: You can help too! No C knowledge is necessary (although it is fun to dive into PHP's internals!). This piece is a short intro to help you help PHP! Help triaging extensions, write tests, add documentation and who knows when you'll be diving into C code.

He's encouraging this work as a part of the recently launched GoPHP7 - Extensions initiative launched a while back. He starts by helping you get PHP7 installed (from source, compiled). Once that's installed and working, he helps you get an extension up and running, in this case the enchant extension. He shows you how to run the tests for the extension and how to write some tests to contribute back to the project. He includes instructions for generating code coverage reports, walks you through some sample code and a link to a page with more information if you get stuck.

0 comments voice your opinion now!
testing improving extension php7 version phpt unittest coverage gophp7

Link: http://www.freeklijten.nl/home/2015/03/12/Testing-and-improving-PHP-extensions-for-PHP-7

MongoDB Blog:
Call for Feedback The New PHP and HHVM Drivers
March 12, 2015 @ 11:33:23

The MongoDB blog has a new post asking for feedback on what the user community thinks of their approach to supporting MongoDB functionality in PHP 5.x, HHVM and even out to PHP7.

Since the PHP driver first appeared on the scene, MongoDB has gone through many changes. [...] Beyond MongoDB's features, our ecosystem has also changed. [...] During the spring of 2014, we worked with a team of students from Facebook's Open Academy program to prototype an HHVM driver modeled after the 1.x API.

[...] Although the final result was not feature complete, the project was a valuable learning experience. The C driver proved quite up to the task, and HNI, which allows an HHVM extension to be written with a combination of PHP and C++, highlighted critical areas of the driver for which we'd want to use C. This all leads up to the question of how best to support PHP 5.x, HHVM, and PHP 7.0 with our next-generation driver.

They've shared the overview of the new driver structure including three layers: the system level functionality, the extensions themselves and a MongoDB userland library. They walk through the thinking on each of the pieces of the puzzle and how they all couple together to make for a more robust, flexible system that's also easy to use.

0 comments voice your opinion now!
mongodb drivers extension mongo userland library architecture opinion feedback

Link: http://www.mongodb.com/blog/post/call-feedback-new-php-and-hhvm-drivers

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


Community Events

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


laravel5 php7 language series library security introduction version api podcast opinion list community interview extension example voicesoftheelephpant framework release laravel

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