php-jsonq – a simple, elegant PHP package to query over any type of JSON data

php-jsonq provides an easy, yet powerful way to build queries for any JSON data (or PHP data structures for that matter, which are a step away).  This has a variety of useful applications – data migration, API response filtering, complex configurations manipulation, and so on, and so forth.

AutoMapper – Declarative data mapper for PHP 7

AutoMapper can map data from array/object to existing array/object or marshal a new one.

Mapping rules specified in declarative way using three simple definitions:

  • From definition (From::create or via short function from) — maps single field from source to target. Supports chainable functions:
    • ->convert(callable $callable) — converts input value to another one via any callable;
    • ->trim() — trims value to eliminate whitespaces (suitable for strings);
    • ->default($defaultValue) — returns default value if source field is missing;
    • ->ignoreMissing() — ignores target field if source field is missing;
    • ->ignoreEmpty() — ignores target field if source field is empty.
  • Aggregate definition (Aggregate::create or via short function aggregate) — maps multiple fields from source to single target field. Supports chainable functions:
    • ->trim() — trims aggregated value
    • ->ignoreEmpty() — ignores target field if aggregated value is empty.
  • Value definition (Value::create or via short function value) — maps constant value to target field. Supports chainable functions:
    • ->trim()
    • ->ignoreEmpty()

All missing source fields can be ignored via AutoMapper::create(...)->ignoreAllMissing() modifier.

Radicale – Free and Open-Source CalDAV and CardDAV Server

Radicale is a free and Open Source CalDAV and CardDAV server.  Here are some of the features:

  • Shares calendars through CalDAV, WebDAV and HTTP.
  • Shares contacts through CardDAV, WebDAV and HTTP.
  • Supports events, todos, journal entries and business cards.
  • Works out-of-the-box, no installation nor configuration required.
  • Can warn users on concurrent editing.
  • Can limit access by authentication.
  • Can secure connections.
  • Works with many CalDAV and CardDAV clients.

Here is a blog post that provides some instructions on how to set it up and synchronize contacts and calendars between multiple services and applications.

RT initialdata and Perl’s nested map

Request Tracker (aka RT) comes with a very powerful, yet not too widely known tool – initialdata.  This helps with automating configuration of the new system and data migration.  Combined with the power of Perl’s map() function, some really awesome things can be done in a jiffy.

Here is a snippet I’ve used recently, to set a list of access rights to a list of queues:

push @ACL, map {
  my $queue = $_;
  map {
    {
      GroupDomain => 'SystemInternal',
      GroupType => 'Everyone',
      Queue => $queue,
      Right => $_,
    }
  } qw(
    CreateTicket
    ReplyToTicket
  )
} qw(
  dpt-Support-EN
  dpt-Support-RU
  dpt-Support-FR
);