Identifying bottlenecks in your PHP scripts, using XDebug and KCacheGrind

This entry focuses on how to identify slow parts of your scripts using the PHP/Xdebug profiling feature along with KCacheGrind for profile data visualisation. Xdebug is a PHP extension used for debugging scripts, supporting stack and function traces and information and memory allocation profilling. KCacheGrind is a profile data visualisation tool, allowing for easy browsing of […]

Symfony2: Folder Structure

This entry describes the Symfony2 directory structure; providing a broad understanding of how a project is structured, and laying the ground for file system level security and customization. Below are diagrams for each main folder, along with a description of its components (based on: http://symfony.com/doc/current/quick_tour/the_architecture.html): app/ folder: AppKernel.php – Main configuration entry point. Provides registerContainerConfiguration and registerBundles. […]

Symfony2 FreeBSD 10 PHP Packages

Below is a list of packages required for Symfony2 running on FreeBSD 10. pkg install php56 pkg install mod_php56-5.6.3 pkg install php56-session-5.6.3 pkg install php56-ctype-5.6.3 pkg install php56-dom-5.6.3 pkg install php56-hash-5.6.3 pkg install php56-mysql-5.6.3 pkg install php56-simplexml-5.6.3 pkg install php56-json-5.6.3 pkg install php56-xml-5.6.3 pkg install php56-hash-5.6.3 pkg install php56-pdo_mysql-5.6.3 pkg install php56-tokenizer-5.6.3 Replace 56 with […]

Create a JavaScript jsonP Class

Classic AJAX requests are limited to the same domain. JSON with padding allows us to make requests to different domains. Below is an example of how to create a jsonP class, and handle requests using PHP. JSON with padding works by making a JavaScript script request, using a SCRIPT tag and a callback function. The back […]

Symfony2: Version and Install Steps

This post marks the start of a series of Symfony2 focused entries, describing how to install Symfony2 and prepare the environment for a new project. Relying on the “Installing and Configuring Symfony” chapter of the Symfony Book, this entry provides details about choosing the right version, and an introduction to composer; followed by step by […]

Prepare your NodeJS Project Using Forever, Nodeunit and ExpressJS

Prior to creating Jenkins jobs and Capistrano recipes you should prepare NodeJS dependencies and scripts. This article does not provide in-depth details about NodeJS. The assumptions are that nodeunit is used for unit testing, forever for process management, and ExpressJS for creating a web server. Step 1: Create a package.json file: NodeJS dependencies and utility […]

PHP 7 Object Properties Type Safety with Setters and Getters

PHP 7 introduces scalar type definitions: your function parameters can be of a given type, and function return type declarations ensuring your function will return results of a given data type. This can increase your code quality by enforcing a specific behaviour of your code, almost similar to how a strongly typed language does. However, […]

CodeIgniter folder structure overview

Below is a quick overview of each CodeIgniter folder, starting from the repository root. application/ – stores the CI core extensions, libraries, configuration, cache, controllers, views, helpers, hooks, languages, logs, models and third_party extensions application/cache/ – stores the application cache application/config/ – stores the autoload, main configuration, database, constants, doctypes, foreign characters, hooks, migration, memcache, […]