Organising PHP Exception Classes

In this tutorial we're going to investigate how we can organise PHP exception classes better in PHP. In PHP you have a lot of options for exception classes each allow you to catch different error stat...

Shorthand Comparisons In PHP

In this tutorial we're going to investigate how we can improve our code by cleaning up unnecessary code by using shorthand code samples in PHP. So what do I mean by removing unnecessary code? The most...

PHP7 Array Iteration Trick

In this tutorial we're going to look into a look tip for dealing with PHP array iterations with PHP 7. When you're developing in PHP and need to iterate over an array you'll probably see something lik...

How To Install xdebug on PHP 7.1

Xdebug is a very useful tool when it comes to PHP development, it's a PHP extension that allows you to profile and debug your PHP code. It even allows you to step through your code during runtime to s...

Increment Numeric Part Of String

Have you ever needed to increment the number which is part of a string. For example if you have an invoice number with the format und001 and want to be able to automatically create the next invoice nu...

Get Keyword Frequency In PHP

In this tutorial we're going to find out how we can get the keyword frequency from a string or even a webpage in PHP. This information is useful when you're trying to work out the SEO of a page so you...

Return Class Constant From Variable

PHP constant values allow you to set a variable on the class which will remain the same and is unchangeable. The difference between these constants and other variables in a class is that they are not...

Preserve Variables Between Unit Tests

Although not strictly unit testing but more functional testing I've been in the situation where I've had to perform automated tests of database interactions. This could be by using a process of creati...

Environment Specific Doctrine Datafixtures

When working on a Symfony project the database you will most likely be working with is doctrine. A bundle used on doctrine you can use in your projects is called data fixtures. Data fixtures are used...

Setting Doctrine Object From ID

In a recent Symfony project I was using Doctrine as the database interface. Doctrine is a set of PHP class libraries that are focused on database storage and database management. The main projects wit...

Doctrine Date Modified On Update

Doctrine is a set of PHP class libraries that are focused on database storage and database management. The main projects with Doctrine are the ORM (Object Relational Manager) and DBAL (Database Abstra...

Output Contents Of A Doctrine Object

I've being doing a lot of development with Doctrine recently and one of the things that I found out is that the Objects it works with can be huge which makes debugging the objects quite difficult for...

Getting Started With Composer In PHP

In this tutorial we are going to learn about composer and how we can use it to develop our PHP applications. Composer is a tool that allows to manage your third party dependencies in your PHP applicat...

Sanitize Special Word Characters With PHP

Anybody who has worked with user content on a website will know the problem you get when a user writes the content in Word and copy and pastes this content into a textarea so that you can store it in...

Install Doctrine With Zend Framework 2

In this tutorial we are going to learn how you can install doctrine into your Zend Framework 2 application. What Is Zend Framework 2? Zend framework is one of the most popular PHP frameworks created...