URL rewriting in built-in web server of PHP

PHP comes with a handy for development built-in web server.  However, most web projects have friendly URLs these days which are either Apache (mod_rewrite) or Nginx specific configuration.  This almost renders built-in PHP web server useless.  Unless you provide a PHP-based routing, like so:

$request_uri = __DIR__ . $_SERVER["REQUEST_URI"];
if (file_exists($request_uri)) {
  return false;
} else {
  include __DIR__ . ‘/index.php';
}

Start the PHP web server with the following command then (routing.php being a file with the above content):

$ cd my-project && php -S localhost:8000 routing.php

Thanks to this blog post and comments.  Now you can completely skip having Apache and Nginx on developer machines and all that shenanigan with configuring virtual hosts, modules, and such.

Extract, Transform, Load

I’ve been doing all kinds of data migrations and system integration for years now.  But only yesterday I’ve learned that there is a very specific term linked to the process.

In computing, extract, transform, and load (ETL) refers to a process in database usage and especially in data warehousing that:

  • Extracts data from outside sources
  • Transforms it to fit operational needs, which can include quality levels
  • Loads it into the end target (database, more specifically, operational data store, data mart, or data warehouse)

ETL systems commonly integrate data from multiple applications, typically developed and supported by different vendors or hosted on separate computer hardware. The disparate systems containing the original data are frequently managed and operated by different employees. For example a cost accounting system may combine data from payroll, sales and purchasing.