Tutorials and Talks How To Find The Directory of Your WordPress Theme in PHP

To get the directory of the current theme (or child theme) you can use get_stylesheet_directory_uri(). Here’s how to use it...



How to Query DNS Records using PHP

DNS records are meant to be stored on a DNS server. Using these servers you can easily get specific DNS records for your own application, apply specific limits etc. This article shows you some ways to get or query DNS records using PHP.



Using the Event Dispatcher in a Silex Application

Gonzalo Ayuso has a new post showing you how to use the Symfony event dispatcher in a Silex-based application. His example involves a simple image processing example, creating a Silex endpoint that creates an image with a given string. He notes that handling it all at once and then unlinking at the end of the request is one way to handle it. The other is to use the event dispatcher to add an event lister (as a closure) to happen "on terminate" to unlink the path it's been given.



Testing Apigility Code-Connected REST APIs

Lorenzo Ferrara has a recent post to his site involving the recently released Apigility from Zend and how to to create a basic API endpoint (with code) for a REST API (complete with screenshots). He talks about creating the first API and what kinds of code files were created as a result - a configuration and three for the API itself: a collection, an entity and a resource file. He shows the changes he made to the resource to return static data from a set of fortunes and the entity class to use it. His screenshots show the results of a few REST requests, one for all of the "cookies" and a few others for specific cookie instances.



CI: Deployments and Static Code Analysis with Drupal/PHP

In this post, I'm going to explain how Jenkins, Phing and SonarQube can help you with your Drupal (or any PHP-based project) deployments and code quality, plus walk you through installing and configuring them to work with your codebase. Bear with me... it's a long post!



Rails-like Console for PHP

If you’ve ever used Ruby on Rails, you know it has an amazing console that allows you to execute code within a fully bootstrapped application environment. With the rails console command, you can gain access to your database and models in a command-line interface read-eval-print loop (REPL) for your application. This is made possible by interactive Ruby, irb. I’ve always been curious why PHP frameworks like WordPress and Magento don’t embrace a similar type of tool, even though PHP has a similar command-line interface that you can access by running php -a in your terminal.



Building a Live-score Widget Using PHP Web Sockets

The introduction of web sockets makes it possible for web applications to handle near real-time data without resorting to "hacks" such as long-polling. One example of an application requiring up-to-the-minute data is sports scores. Even now, many websites which display this information use Flash applications, since Actionscript provides the facility to communicate over socket-based connections. However, web sockets allow us to replicate this functionality using only HTML and Javascript. That's what we're going to build in this tutorial, along with a lightweight "server" in PHP.



Building a Web App With Symfony 2: Bootstrapping

On the SitePoint PHP blog today, Taylor Ren has started up a new series about building web applications with the Symfony 2 framework. In this first post he looks at one of the initial steps - bootstrapping (setting up) the framework and application. This first part helps you get everything all set up - the latest version of the framework, Composer and checking for the default page to make sure everything's configured correctly. From there he starts to get into the "guts" of the application, introducing the MVC elements (entities), routing concepts and database configuration/integration.



PSR-2 v CodeSniffer PSR-2: A Success Story

In a new post to his site Phil Sturgeon talks about the "success story" around the PSR-2 PHP-FIG standard and his work to get the PHP CodeSniffer checks to be more correct for it.



Responsive Images Using Picturefill and PHP

On the SitePoint PHP blog there's a new post from Lukas White showing you how to use the Picturefill plugin (Javascript) along with PHP to make responsive images. The tutorial helps you create an application, powered by the Slim framework and the ImageMagick extension, for the basic structure. He then grabs the Picturefill library and drops them into place. Some sample code is also included showing how to create the HTML structure for the images and the Javascript to handle the switching.



Sharding PHP with MySQL Fabric

Johannes Schlüter has a new post to his site showing how to use the MySQL Fabric functionality to do sharding in your PHP application. The MySQL Fabric (recently released) is "an integrated environment for managing a farm of MySQL server supporting high-availability and sharding." He walks you through the installation of the support for Fabric and how to configure it for storage.



Zephir - Build PHP Extensions Without Knowing C

Due to PHP being written in C, for a long time now the only way to extend it was to either rely on the current generation of enthusiastic greybeards, or take up C. For many, the latter wasn't an option. We, the high level developers of today, are far too lazy to take up such a wonderfully precise, demanding, low level, OCD-centric language. It would take me just as long to waddle through an intermediate C program as it would an experienced low level developer to develop a pretty cross-browser compatible JS radial context menu. So how, then, is a PHP developer supposed to enrich PHP itself with much needed functionality? To get the directory of the current theme (or child theme) you can use get_stylesheet_directory_uri(). Here’s how to use it...DNS records are meant to be stored on a DNS server. Using these servers you can easily get specific DNS records for your own application, apply specific limits etc. This article shows you some ways to get or query DNS records using PHP.Gonzalo Ayuso has a new post showing you how to use the Symfony event dispatcher in a Silex-based application. His example involves a simple image processing example, creating a Silex endpoint that creates an image with a given string. He notes that handling it all at once and then unlinking at the end of the request is one way to handle it. The other is to use the event dispatcher to add an event lister (as a closure) to happen "on terminate" to unlink the path it's been given.Lorenzo Ferrara has a recent post to his site involving the recently released Apigility from Zend and how to to create a basic API endpoint (with code) for a REST API (complete with screenshots). He talks about creating the first API and what kinds of code files were created as a result - a configuration and three for the API itself: a collection, an entity and a resource file. He shows the changes he made to the resource to return static data from a set of fortunes and the entity class to use it. His screenshots show the results of a few REST requests, one for all of the "cookies" and a few others for specific cookie instances.In this post, I'm going to explain how Jenkins, Phing and SonarQube can help you with your Drupal (or any PHP-based project) deployments and code quality, plus walk you through installing and configuring them to work with your codebase. Bear with me... it's a long post!If you’ve ever used Ruby on Rails, you know it has an amazing console that allows you to execute code within a fully bootstrapped application environment. With the rails console command, you can gain access to your database and models in a command-line interface read-eval-print loop (REPL) for your application. This is made possible by interactive Ruby, irb. I’ve always been curious why PHP frameworks like WordPress and Magento don’t embrace a similar type of tool, even though PHP has a similar command-line interface that you can access by running php -a in your terminal.The introduction of web sockets makes it possible for web applications to handle near real-time data without resorting to "hacks" such as long-polling. One example of an application requiring up-to-the-minute data is sports scores. Even now, many websites which display this information use Flash applications, since Actionscript provides the facility to communicate over socket-based connections. However, web sockets allow us to replicate this functionality using only HTML and Javascript. That's what we're going to build in this tutorial, along with a lightweight "server" in PHP.On the SitePoint PHP blog today, Taylor Ren has started up a new series about building web applications with the Symfony 2 framework. In this first post he looks at one of the initial steps - bootstrapping (setting up) the framework and application. This first part helps you get everything all set up - the latest version of the framework, Composer and checking for the default page to make sure everything's configured correctly. From there he starts to get into the "guts" of the application, introducing the MVC elements (entities), routing concepts and database configuration/integration.In a new post to his site Phil Sturgeon talks about the "success story" around the PSR-2 PHP-FIG standard and his work to get the PHP CodeSniffer checks to be more correct for it.On the SitePoint PHP blog there's a new post from Lukas White showing you how to use the Picturefill plugin (Javascript) along with PHP to make responsive images. The tutorial helps you create an application, powered by the Slim framework and the ImageMagick extension, for the basic structure. He then grabs the Picturefill library and drops them into place. Some sample code is also included showing how to create the HTML structure for the images and the Javascript to handle the switching.Johannes Schlüter has a new post to his site showing how to use the MySQL Fabric functionality to do sharding in your PHP application. The MySQL Fabric (recently released) is "an integrated environment for managing a farm of MySQL server supporting high-availability and sharding." He walks you through the installation of the support for Fabric and how to configure it for storage.Due to PHP being written in C, for a long time now the only way to extend it was to either rely on the current generation of enthusiastic greybeards, or take up C. For many, the latter wasn't an option. We, the high level developers of today, are far too lazy to take up such a wonderfully precise, demanding, low level, OCD-centric language. It would take me just as long to waddle through an intermediate C program as it would an experienced low level developer to develop a pretty cross-browser compatible JS radial context menu. So how, then, is a PHP developer supposed to enrich PHP itself with much needed functionality?