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

How to Create a PHP C Extension to Manipulate Arrays Part 1: Basic Array Class Exten
Aug 11, 2015 @ 10:27:24

Dmitry Mamontov has posted a the first part of a series looking at manipulating arrays in the PHP source and enhancing performance for certain handing as a PHP extension.

In PHP projects, arrays are used every where because they are useful and flexible to store all sorts of data structures. However, when you need to maximize the performance the manipulation of arrays for specific purposes, you can achieve great gains if you implement a PHP extension written in the C language. Read this tutorial to learn how to build your own basic array manipulation extension in C.

He covers all the steps you'll need to get start building the extension, introduces a few key concepts and starts on the code for the extension:

  • Building PHP from the Source
  • Building a PHP Extension (overview)
  • Brief Introduction to zval and Functions
  • Defining a Class in Our Extension
  • D for Dynamic (working with dynamic array values)

The C code needed is included through out the post. The next part in the series will build on this and show how to implement interfaces like ArrayAccess and Traversable.

tagged: extension array manipulate part1 series introduction source

Link: http://www.phpclasses.org/blog/post/304-How-to-Create-a-PHP-C-Extension-to-Manipulate-Arrays--Part-1-Basic-Array-Class-Extension.html

Check Point Blog:
Finding Vulnerabilities in Core WordPress: A Bug Hunter’s Trilogy, Part I
Aug 06, 2015 @ 11:44:14

The Check Point blog has posted the first part of a series from one of their vulnerability researchers about finding security vulnerabilities in the core WordPress code (and some of the results along with CVE numbers).

In this series of blog posts, Check Point vulnerability researcher Netanel Rubin tells a story in three acts – describing his long path of discovered flaws and vulnerabilities in core WordPress, leading him from a read-only ‘Subscriber’ user, through creating, editing and deleting posts, and all the way to performing SQL injection and persistent XSS attacks on 20% of the popular web.

In this first part he focuses on the concept of "identity" in a WordPress application. He focused on the "roles and capabilities" functionality to find bypass methods in operations like editing and adding new posts. As he works through his process, code is included from the WordPress core showing where the issue(s) lie and what would be needed to exploit the issue.

tagged: bug hunt wordpress vulnerability core code part1 series checkpoint

Link: http://blog.checkpoint.com/2015/08/04/wordpress-vulnerabilities-1/

SitePoint PHP Blog:
Appserver – a Production-ready PHP-based Server
Aug 06, 2015 @ 08:57:44

The SitePoint PHP blog has posted a new review of Appserver, a "production-ready PHP application server" that includes a web server written in PHP. Appserver is a downloadable project that can be run on any server that already has PHP installed.

You’re probably asking, “Why is appserver paradigm changing?” The answer is, because it tackles the last frontier of PHP application development: high performance for large applications from a server resource optimization and collaboration perspective. This is the realm of PHP development which a good number of professional PHP developers have been calling for, like Manuel Lemos in his “PHP7 Features and Release Date” blog (see the section about a “Standalone Multi-threading Web Server”) and Fabien Potencier, father of Symfony, in his presentation “My Take on PHP”, where he notes he is also working on such an application server solution himself. Well, look no longer Fabien, we already have a really good solution with appsever.io.

In this first part of a new series author Scott Molinari introduces some of the basic concepts behind an appserver in general and helps you get the software installed. He talks about threading and compares the typical PHP server stack against the appserver approach. The main difference is that, with the appserver, there's more control over what's destroyed for each request, allowing more control over the execution and reuse of components. He points out that it does require a bit of different kind of thinking to write code that works with an appserver. He finishes off the post with a few quick steps to getting the latest version of the Appserver build into a local VM via the apt-get package manager and starting it up.

tagged: appserver appserverio application server introduction part1 series concept installation

Link: http://www.sitepoint.com/appserver-a-production-ready-php-based-server

Mattias Noback:
Refactoring the Cat API client (3 Part Series)
Jul 16, 2015 @ 11:25:54

Mattias Noback has posted a three part series of tutorial articles around the refactoring of a "CatApi" class. These articles take the class from a jumbled mess of functionality with both direct file access and remote requests mixed in into something much more maintainable and flexible.

t turned out, creating a video tutorial isn't working well for me. I really like writing, and speaking in public, but I'm not very happy about recording videos. I almost never watch videos myself as well, so... the video tutorial I was talking about won't be there. Sorry! To make it up with you, what follows is a series of blog posts, covering the same material as I intended to cover in the first episodes of the tutorial.

In part one he introduces the current state of the "CapApi" class and some of the problems with it, both in testing and in structure. He does some basic refactoring to split out some of the logic here and moves on to part two. In the second part of the series he focuses on refactoring the HTTP request and the local file system functionality into abstract, injectable objects. Finally in part three he adds in some verification around the data being passed back and forth between objects including both simple checking and the use of value objects.

tagged: refactor api class series part1 part2 part3 filesystem http request xml validation

Link: http://php-and-symfony.matthiasnoback.nl/2015/07/refactoring-the-cat-api-client-part-1/

BitExpert Blog:
Think About It: PHPExcel Performance Tweaks (Part 1)
Jul 07, 2015 @ 10:34:21

Florian Horn has posted the first part of a series of performance tweaks for using PHPExcel to work with Excel spreadsheets and CSV data.

A few weeks back I covered a small article about a CSV-Tool optimized for memory usage and additionally tweaking performance. Our performance optimization sprint contained the improvement of read file data, processing and persist it. While the file data is relatively small referred to the file size, the amount of data sets can vary between 5.000 and more then 40.000 entities on an average, but may be a lot more in some cases.

This article is the first of a three-part series and describes how we tweaked PHPExcel to run faster while reading Excel and CSV files.

In this first part of the series he goes through three different tips to improve some of the basic performance:

  • Cache Cell Index in Memory
  • Iterators and GC Optimization
  • Use Custom Read Filters

You can find out more about the PHPExcel library on the project's main page.

tagged: phpexcel performance tweak series part1 cache iterators filter

Link: https://blog.bitexpert.de/blog/think-about-it-phpexcel-performance-tweaks-part-1/

SitePoint PHP Blog:
Crawling and Searching Entire Domains with Diffbot
Jul 02, 2015 @ 09:41:39

The SitePoint PHP blog has a new tutorial posted, the first part in a new series, showing you how to create a "powerful custom search engine" with the help of the Diffbot service. In this first part they help you get everything you need set up (including a VM to run it from).

In this tutorial, I’ll show you how to build a custom SitePoint search engine that far outdoes anything WordPress could ever put out. We’ll be using Diffbot as a service to extract structured data from SitePoint automatically, and this matching API client to do both the searching and crawling. I’ll also be using my trusty Homestead Improved environment for a clean project, so I can experiment in a VM that’s dedicated to this project and this project alone.

He walks you through each step of the process, first creating the "crawljob" script and then executing it to gather the results. He also shows how to show this information via a simple GUI when searches are performed. A Diffbot PHP client library makes creating the crawljob simpler and lets you configure things like max number of items to crawl, patterns to match and what URLs to follow on the pages. Running the script creates the job which is then executed immediately. The same library makes search the data simpler too, using a "search" method along with some special tagging, and returning a JSON result with the matching records.

tagged: crawl domain diffbot search engine part1 series tutorial

Link: http://www.sitepoint.com/crawling-searching-entire-domains-diffbot/

Loïc Chardonne:
Symfony Differently - part 1: Introduction
Jun 12, 2015 @ 08:48:26

Loïc Chardonne has kicked off a new series of posts on his site that talk about doing "Symfony Differently" and some things to consider/change to increase your Symfony application's performance.

Symfony is an amazing HTTP framework which powers high traffic websites. Performance shouldn't be a concern when first creating a website, because between the time it is launched and the time it actually has a high traffic many things that we didn't expect in the first days will happen: requirements will change, user behavior will change, even the team can change.

Optimizing applications has an impact over maintenance, and making it harder to change right from the beginning might not be the best option. However when the need of performance actually arises, we need to tackle it. This series of articles is about this specific moment, and how to tackle it in a pragmatic way.

He starts with a basic project (Acme) and works through the process of adding a new feature to it: buying an item. He talks about the team they have to work with and the architecture of his sample application (a frontend application mostly). He then works through the data structure and flow of the new feature and other functionality that should be included. He ends the post with a bit of a wrap-up of this first part and talks about the next part in the series where the application will actually be bootstrapped.

tagged: symfony performance optimize introduction project requirements team resources series part1

Link: http://gnugat.github.io/2015/06/03/sf-differently-part-1-introduction.html

PHP Roundtable:
021: From Idea To Production: Part 1
May 29, 2015 @ 12:17:24

The PHP Roundtable podcast, hosted by Sammy Powers, has a new show posted (#21) staring off a series about moving from just an idea to a production application. His guests for this episode are Steven Maguire, Jocelyn Lopez and Glen Hinkle.

We discuss an idea for a web app and identify ways to turn it into a real-life product on the web.

We start with describing the domain and the problems the app should solve. Then we identify the personas that will interact with the app. We discuss the features features the app should have to fix the problems and we sort all the features by priority. Finally we talk about timeline, deliverables and next steps. The app we discuss will be launched to production by the next airing of this multi-part series of taking an idea to code.

You can watch this latest episode either through the in-page video player or directly over on YouTube

tagged: phproundtable podcast video idea production application part1 ep21

Link: https://www.phproundtable.com/episode/part-1-turning-an-idea-into-code-for-production

Damien Seguy:
Prepare for PHP 7 error messages (Series)
May 26, 2015 @ 09:35:11

For those looking forward to PHP 7, there's a new series of posts from Damien Seguy that can help you with some of the newer error messages and what might be causing them.

The first step to prepare for PHP 7 is to lint it : using the command line instruction ‘php -l script.php’, one can easily check that every file in a current application compile with PHP 7. The second step is to run the application and the unit tests : in short, execute it with PHP 7. And this is where we’ll learn about the new errors that PHP has prepared for us. In order to be one step ahead of the migration, this article will help you prepare here is a panorama on PHP error messages.

In part one he looks at some of the most often raised errors including the incorrect use of "$this" and undefined offsets. Part two gets into a few more complex messages about return type hinting, the constant scalar expression and using temporary expressions in a write context. Finally, part three looks at messaging around redefinition of identical parameters, bit shifting by a negative number, named constructor deprecation and strict typing. Each part of the series covers a few more than just the ones listed here too, so be sure to check each for more helpful error messages and solutions.

tagged: php7 error message help series part1 part2 part3 resolve information

Link: http://www.exakat.io/php-7-error-messages-part-1/

SitePoint PHP Blog:
Bootstrapping a Laravel CRUD Project
May 21, 2015 @ 11:18:27

The SitePoint PHP blog has kicked off a new series about using the Laravel framework to create a basic CRUD application relatively easily.

In this tutorial, we’re going to build and run a simple CRUD application from scratch using Laravel 5.

The target audience for the tutorial are those completely new to the world of Laravel so they start at the beginning. He walks you through the creation of a new Laravel project and the database setup and configuration. He goes through the creation of "resourceful routing" and using the Laravel "artisan" command line tool to generate the matching controller. From there he talks about views and Blade templating followed by the creation and execution of the needed database migrations. The tutorial wraps up with a look at the model system included with Laravel and how they fit in with the Eloquent ORM.

tagged: bootstrap crud project laravel tutorial series part1 introduction

Link: http://www.sitepoint.com/bootstrapping-laravel-crud-project/