php

Phing: a build system for PHP

Phing (recursive acronym for PHing Is Not GNU make) is a PHP project build system closely modelled on Apache's Ant tool for Java development and implemented in PHP. Phing, like Ant, uses simple XML build files to determine what to do as part of the build process. Why would you need a build system? Certain tasks might need to be performed repeatably during application development (on a large project or a small one). These might include:

  1. collect files from different folders and assemble them in one folder, optionally renaming them in the process
  2. automatically check that the code adheres to a coding standard
  3. extract code from a repository and run unit tests
  4. change configuration files from development settings to production/staging settings
  5. generate project documentation from code
  6. strip comments from production code to make it lighter-weight
  7. automatically search and replace words or phrases in files
A build system, such as Phing, can go a long way towards helping you do this with only a few keystrokes. Phing can call tools/packages, and is also easily extended, using your favourite language - PHP, to handle any reasonably strange requirement you might have.

Tags: 

Content Compression Using PHP

Content compression is probably the easiest approach to reduce page weight, and can have a big impact on page load times. Not all content can be compressed - images, PDFs etc are likely to be compressed already. The best candidates are text files - HTML, XML, CSS, Javascript etc

HTTP 1.0 introduced the idea of content encodings. The Accept-Encoding request-header was expanded on in HTTP 1.1, enabling a browser/client to notify the server that it can accept compressed content by sending the header. The Accept-Encoding header can be set as follows: Accept-Encoding: gzip,deflate or with just one of gzip or deflate. PHP will automatically choose the correct compression to use. Gzip is by far the most popular and widely used compression method. For Apache 2.x, gzip compression is handled by the mod_deflate module.

Tags: