Squiz Labs Blog - The latest news from the R&D division of Squiz®

Subscribe to our RSS feeds

PHP_CodeSniffer 2.2.0 released

I've just released version 2.2.0 of PHP_CodeSniffer. This release brings the usual bug fixes, but also quite a lot of sniff changes (the PHPCS and Squiz standards have changed as a result) and some important new features as well. Thanks to all the developers who directly contributed code to this release.

PHPCS Config File

I find myself regularly running PHP_CodeSniffer over a code base using the same command line arguments each time. I could put most of these arguments into the project's ruleset.xml file, but I would still need to specify what files and directories need to be checked, and what coding standard to use.

From version 2.2.0, if PHP_CodeSniffer is not given a list of files to check and is not given a standard to use, it will look for a phpcs.xml file in the current directory to figure out what it should do. The phpcs.xml file has the exact same format as a normal ruleset.xml file, so it can also be used as your primary standard. But it should also specify some files and/or directories to process using the new ruleset <file> tags. Take a look at PHP_CodeSniffer's own phpcs.xml file for an example.

Having one of these phpcs.xml files allows you to run the phpcs or phpcbf commands without specifying any command line options and still have them check or fix an entire codebase.

If you are using the phpcs.xml file as your primary standard, the files and directories you specify in there will be ignored if any files or directories are specified on the command line. So you can run phpcs like this:

$ phpcs

Or you can use the phpcs.xml as a normal standard:

$ phpcs --standard=phpcs.xml /path/to/file

Coloured Report Output

After years of prompting, I've finally added colours to the report and progress output that PHP_CodeSniffer produces.

If you want to see colours in the output, use the --colors command line argument. Use the command phpcs --config-set colors true to turn colours on by default, or configure it in your ruleset. If you have done this, use the --no-colors command line argument to turn colours off for a single run.

Hopefully the colours are tastefully used and don't feel like using colour just for the sake of it. If you disagree, please let me know.

Auto-Sizing Reports

PHP_CodeSniffer has always allowed you to set a report width so that you can see more output in the screen-based reports. From version 2.2.0, you can tell PHP_CodeSniffer to use as much space as it can by adding --report-width=auto to the command.

When using auto width, PHP_CodeSniffer will use the entire width of your terminal window to produce report output. If the report doesn't need all that width, PHP_CodeSniffer will only use as much as it needs to print the report without wrapping. Use the command phpcs --config-set report_width auto to use auto-sizing by default, or configure it in your ruleset.

PSR2 Tab Width

The PSR2 standard now includes a tab-width setting of 4 in the ruleset.xml file. PSR2 requires 4 spaces for indenting, so running that standard over tab indented code will now detect, and optionally fix, those tab indents correctly without you needing to specify the --tab-width=4 command line argument.

View the full 2.2.0 changelog at PEAR or Github

Stay up to date on all PHP_CodeSniffer changes, including new features and releases, by subscribing to the RSS feed or following me on Twitter.

Squiz Matrix Newsletter #504

This week we have one new feature to report, a new trigger action to assign the current user to a specified list of user groups. Continue reading below for more information on all this week's developments.

Assign User to User Group

Due for release in version (TBA)

The Assign User to User Group trigger action has been added in order to add the current user (i.e. the user who fired the event) to a specified user group, or list of groups.

Users can be assigned to user groups either as a physical link, or for the current session.

The Fixed User Groups to Join settings in this trigger action allow you to manually select the user groups that the user will be assigned to, while the User Groups to Join by Name section allows you to set dynamic sources for specifying these user groups.

The Assign User to Group Trigger Action 

When assigned user groups by name, the trigger action's settings allow you to first specify a root note to search for user groups under. You can then create Value Matching Conditions rules to match a specified value against a user group keyword replacement.

Alternatively, you can also enter a list of user group names to look for. If these groups are not found, the Create User Groups option allows you to specify to create these user groups under the selected root not, and link the user to these groups.

The Assign User to User Group trigger action has been added to compliment the Join/Leave User Group for Session actions, now allowing you to add users as a physical link. This trigger action and its user group matching features are also useful when dealing with user accounts created by a SAML Account Manager, in order to manage user groups based on SAML attributes.

Squiz Matrix Newsletter #503

Welcome back! It's 2015 and the year ahead is set to be a busy one for the Squiz Labs team. We already have some exciting developments in the works and trust me, there is a lot to look forward to!

Unfortunately, all can not be revealed just yet... but we have some nice goodies to tide you over.

Our first releases of the year will be out next week and we already have some new features to report, including enhancements to the system's Purge Trash tool.

Continue reading below for more information on all this weeks developments. 

Purge Trash Tool Enhancements

Due for release in version (TBA)

The Purge Trash tool in Squiz Matrix allows you to remove the assets on your system that are currently in the trash.

Previously, the Purge Trash screen allowed you to purge either all assets in the trash, or those from a certain selection(s) of these assets (based on root node).

This feature introduces a new field to purge assets based on their age, as well as new scheduling options.

The Link Age field allows you to specify a time period value. If this field is set, when a user selects to purge the trash and clicks Commit, only links in the trash that are older than the specified time period will be purged.

The new Link Age field 

The Link Age field allows you to specify a time period value in either minutes, hours, days, weeks, months or years.

Additionally, a new Purge Trash Job Scheduling section has been added on the Purge Trash screen, allowing users to set a scheduled job for purging trash, where you can also specify the root nodes and/or link ages to purge.

You can set the time the purge should be scheduled, and can then specify whether or not to repeat the job at a selected time interval (minutes, hours, days, etc.).

These enhancements have been added to aid in the purging of trash on systems with large numbers of assets in their trash. These tools should help streamline the purging process and allow users to more accurately identify and select the assets they want to purge.

New Exiftool Tool for Metadata Extraction

Due for release in version (TBA)

Squiz Matrix will now use Exiftool for metadata extraction, which supports different image metadata formats such as EXIF, XMP, IPTC, etc.  The previous tool used by Matrix, the PHP JPEG Metadata Toolkit was used for extracting XMP data only.

Once upgrading to Matrix 5.2, systems using the old PHP JPEG Metadata Toolkit tool will receive a warning regarding the missing Exiftool when attempting to create or upload new image files.

Additionally, previously extracted image metadata using the old tool will remain unaffected, until the metadata is re-extracted using the new Exiftool tool.

Squiz Matrix Newsletter #502: The Year That Was...

While Squiz Labs has been as busy this year as we ever have, 2014 was a year headlined by a few major announcements and releases, rather than a constant stream of news. This meant that throughout the majority of the year, we've were working hard towards what has been some of the most significant developments ever for our Squiz Matrix product, headlined by the release of Matrix 5.

In this week's newsletter, we take a look back at the year that was. So grab yourself a cup of coffee, make sure your comfortable and let's relive 2014.

Squiz Labs 2014

As is the norm, the year began with a string of our first Matrix releases of 2014 on January 6th. Versions 4.16.6 and 4.18.2 were the first two of fifty-six releases of Squiz Matrix this year!  Head over to our Release Information page for a full list of this year's releases.

Squiz Matrix 5 

In March, the upcoming release of Squiz Matrix 5 was announced for late April. With months of development, Matrix 5 was poised to be the most significant leap in the history of our product, with notable updates and improvements to almost every aspect of the system. Two of the most apparent changes were our new Administration and Edit+ for Squiz Matrix interfaces, which we headlined in our announcement blog post.

Later in March, Matrix 5 went into testing and a release date of Monday, April 28 was set. 

Also in late March, Labs celebrated Harmony Day with a multicultural bring-and-share lunch. It was a delicious melting pot of cuisines, with main dishes including baked macaroni, stir-fried beef, prawn noodles, pastizzi, chicken curry, spinach cob dip, pierogi, momo dumplings, not to mention lemon semolina cake, profiteroles, and bread and butter pudding for dessert. So good!

Squiz Labs Harmony Day

April was an extremely busy month, leading up to the release of Matrix 5. We kicked off the month by announcing that, as of Matrix 5, the Edit+ for Squiz Matrix WYSIWYG editor would be available for use within the administration interface for Squiz Plus customers.

We also made changes to the way we distributed access to our Matrix code versioning system, with Matrix moving to Git from the release of Matrix 5.

Later in April, we outlined a new release schedule for Squiz Matrix and updated versioning system. As of Matrix 5, Labs moved to a more ad hoc release system, releasing new versions as they were warranted.

It was also time to say farewell to the trusty Bug Tracker, that had been around since the launch of Matrix and had seen almost 7000 bugs reviewed and resolved. With Matrix 5, bug management moved to Squiz's internal Roadmap system, Squizmap.

Finally, at the end of April, Squiz Matrix 5 had arrived! Matrix 5 welcomed new, completely revamped interfaces for both the Administration and Edit modes, as well as new Marketo integration tools, conditional content rules, and support for the Edit+ Editor in the back-end.

In May, Squiz Labs revealed our brand new logo. It was pretty similar to our previous logo, except ... better. We made some minor adjustments to bring Labs more inline with the rest of Squiz. Did you know that the Labs logo is an ambigram, meaning that it can be turned 180° and still look the same? I think that's kind of awesome.

Squiz Labs Logo

Towards the end of June, we announced a new Maintenance Mode for Squiz Matrix designed to assist in the system upgrade process. This mode, when enabled, would disable the functionality of specified assets on the front-end, instead printing a maintenance message for your users.

The Maintenance Mode Enabled Message

News for July was headlined by our announcement of Matrix 5.1 and, as as we approached the September release, we detailed much of the exciting new functionality that could be looked forward to.

In August, we presented our new depreciation system for old and unused assets and features, which was to be implemented with out Matrix 5.1 release. We also announced a number of assets that would be moving into the first phase of the deprecation process in the upcoming release.

Also in August, we released v.1.7.0 of Squiz Roadmap, containing a bunch of great new functionality, including a new Batch Edit interface, a new way to easily move ideas between projects, and a new project creation system. To read more, check out the What's New in the Latest Release of Squiz Roadmap? blog post.

On the 1st of September, Squiz Matrix 5.1 was made available, our first minor release since we had unveiled Matrix 5 back in April. It would be an overstatement to say that Matrix 5.1 was jam-packed with functionality, with over sixty brand new features and enhancements!

In early December, the Squiz Matrix Newsletter celebrated our 500th edition. We celebrated with some cool facts about the Matrix newsletter (Did you know it's been running for over 10 years now?) as well as some of our favourite past newsletters.

We wrapped up the year this week with our Labs end-of-year celebration lunch, and a Christmas morning tea, complete with secret santa gifts! It has certainly been a fun way to cap off the busy year.

Xmas Morning Tea

2014 was a year of development and growth for Squiz Labs, most notably for our Squiz Matrix product. We're definitely proud of the leaps and bounds that Matrix has made over the past year, along with our other products and releases.

We do have a lot of other exciting developments just hanging in the wings, waiting for their moment to shine! 2015 is sure to be another big year for Squiz Labs, so stay tuned!

2013 Xmas Logo

On behalf of the Squiz Labs team, we want to wish all our readers a very Merry Christmas and a Happy New Year. Have an enjoyable and safe holiday break. We'll see you all again in 2015!

Squiz Matrix Newsletter #501

As we near the end of the year, the busy elves here in the Squiz Labs office have been hard at work, crafting up two new releases of Squiz Matrix this week! Versions and are patch releases, each containing a variety of bug fixes, as well as a minor enhancement for our 5.1 release.

Xmas Tree 

Next week will be our last full working week of the year. We'll be releasing our final Matrix releases of the year, versions and on Wednesday, December 17th.

It will also be our last newsletter of the year. As usual, we'll be taking a look back at the year's highlights in our Squiz Labs 2014 retrospective. Be sure to check back next week for that!


This week we have one new feature to report, the ability to clone assets within the Edit+ for Squiz Matrix interface. Continue reading below for more information on all this week's developments.

Edit+ for Squiz Matrix: Clone Asset Tool

Due for release in version (TBA)

Along with moving and link assets, Squiz Matrix's Administration Interface allows users to clone assets, creating a copy of the asset and any of its dependent assets in another area of your system.

Learn more about cloning an asset.

This functionality, however, was not previously available when using the Edit+ for Squiz Matrix editing interface. 

This feature introduces the ability to clone assets within Edit+ via a new Clone Existing Asset button in the Asset Creation Wizard pop-up (accessed when creating a new asset).

The Clone Existing Asset pop-up 

Clicking this button will display the Clone Existing Asset pop-up, allowing you to select the asset you want to clone, enter a name for the cloned asset and specify where in the system you want to create the asset.

When you have configured these settings, clicking the Clone button will create a clone of your asset.

Cloning an asset 

This feature has been added to further enhance the Edit+ for Squiz Matrix interface and the functionality available. 

Squiz Labs

R & D division of Squiz Pty Ltd

Open source web experience management solutions

Squiz Labs is the research and development division of Squiz, the company behind the Squiz Suite of web experience management and development tools.

Our PHP and JavaScript developers are responsible for producing innovative enterprise-quality software while our interface designers and testing team ensure our products both look great and are easy to use.