How to load private repository


Before you can load your private repository with composer, make sure you have setup
a composer.json file in your repository that contains at least a name. Also you need to setup atleast a tag.

From your local PC you need to have at least an SSH key matching your repository or user. Also, you should add the repository to your composer.json (because its private, right- how else should composer know about it?).
Something like this:

        "your-package-name-from-composer-json-in-gitlab": "*"
    "repositories": [
            "type": "vcs",
            "url":  ""

And thats it. Enjoy!

How to fix FPDF error: Undefined font

If you get this error, this could have one of the following causes

1. You forgot to set the font

Before you set the font, its necessary to add the font!

$pdf->AddFont('DejaVuSansCondensed', 'B', 'DejaVuSansCondensed-Bold.ttf', true);

$pdf->SetFont('DejaVuSansCondensed', 'B', 11);

2. You forgot to set the fontpath

Imagine you have specified some custom fonts then you need to set the path to the font folder beofre you add the font:

$pdf->fontpath  = '/fonts/tfpdf/font';

$pdf->AddFont('DejaVuSansCondensed', 'B', 'DejaVuSansCondensed-Bold.ttf', true);

Although the font "DejaVuSansCondensed-Bold.ttf" is in the folder "/fonts/tfpdf/font/unifont/" you still have to set "/fonts/tfpdf/font/" as the fontpath

3. You add the same font by different names

This issue is tricky and took me ages to find. Imagine, that you add somewhere in you code this:

$pdf->AddFont('DejaVuSansCondensed', 'B', 'DejaVuSansCondensed-Bold.ttf', true);

Once this is called, it will save the name in the file dejavusanscondensed-bold.mtx.php.

If you now use in an other method the same font but witha different name:

$pdf->AddFont('DejaVuSansCondensed-Bold', '', 'DejaVuSansCondensed-Bold.ttf', true);

The script will fail with an undefined font error. To fix this, make sure that your script is not using multiple names for the same font, and remove all .dat and .php files inside the /font/unifont/ folder (that clears the cache).

How to download single database from PLESK backup manager

If you want to download a single database from backup, its not possible through the PLESK GUI. You can only download the full webspace which may be multiple GB large.

But there is a trick. The content of every webspace is stored in


Every webspace has a databases subfolder:


Visit the folder with SSH and checkout which folder corresponds to your database. Then, just download it throug your shell:

scp -r root@host:/var/lib/psa/dumps/domains/**webspacename**/databases/**your-db**/ folder-to-store

The folder contains all the backups from your database. I think by default these are the copies from the last 7 days.

Load does not work for dynamical relationships?

Imagine you have the following two relations:

 * Relation working/holiday/.. hours
 * @return [type] [description]
public function relatedHours($type = null)
  $type = $type ?? $this->type;
  return $this->hours()->where('type', '=', $type);

 public function workingHours()
  return $this->relatedHours(Type::WORK);

Continue reading "Load does not work for dynamical relationships?"

Print from browser directly to Dymo LabelWriter

In this post I explain how one can print immediately to the Dymo LabelWriter just by pressing a button in your web app. The printer dialog will be omitted which has two mayor benefits:

  1. Saving you the time to select the correct paper-size and printer.
  2. Prevents you from accidentally printing on the Dymo (because the last printer used in the printer dialoge is most often preselected).

Continue reading "Print from browser directly to Dymo LabelWriter"

Imap Basics

I explain how to delete or move mails from a mail account through a script.

First you should setup a connection. This should look like this:

  /* connect to server  */
  $hostname = '{}'; 
  $username = '';
  $password = 'top_secreted_69';

  /* try to connect */
  $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to mailbox: ' . imap_last_error());

Continue reading "Imap Basics"