Setting up papertrail on forge.

Looking for log files can be quite a hustle. Fortunately forge  ( ) + papertrail (  )makes this a downright simple process. Assuming you already have an active forge and papertrail

Step 1:

Create a new logging system in papertrail

Take note of your specific link.

Hint: It is the content in large text***.
Step 2:

Login to your forge installation.

Select the server you want to manage and then navigate to the monitoring tab.

There is an option for papertrail. Paste in your link and click install.

Step 3:

Navigate back to papertrail and wait till your server shows up on the “All Systems” list.

And you are good to go. Happy logging!!


The Final Word

Among the list used keywords in php is “final”

The definition from

PHP 5 introduces the final keyword, which prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.

If you are anything like me, then your first thought must have been why would I want to kill inheritance and polymorphism. This does seem like a needless, neigh, a downright harmful operation. However this keyword plays a very important role in your application design.

One use case is where you would want to carry out the Introduce Parameter Object Refactor .

Our original class looks like this:

Once we have refactored:


So far all is well. Now imagine way into the future, you decide to make the date output a bit more user friendly, and being a good developer you extend the DateRange class with a new method

While all may look well. This bit of code will break all classes that used it as parameter!

When you really think about it, you realize that DateRange had no business being extended and should have been treated as a primitive object, just like the parameters it replaced.

As such this class should be declared final to protect it from further meddling and even more importantly to ensure consistency of your code.



Recovering Homestead Instance

If you don’t know about homestead, its a vagrant box that automatically configures a great development environment for laravel.

The box should always be suspended before shutting down your machine to prevent loss of data.  This is not always possible and you may lose data. This may include data stored in database, new applications installed, custom configurations etc.

You will likely notice the loss of data when you try to run

vagrant up

on your box.

The steps detailed below are for Ubuntu 14.04, Virtualization provided by Oracle’s Virtual Box



Open terminal and run

VBoxManage list vms

This will give you a list of existing instances. That look something like this

"Homestead_default_1404163399305_36682" {193c3aff-1024-429d-bfe8-6fc4f5e95e1d}
"Homestead_default_1406635335344_88720" {2dc5a526-338d-4c6d-8483-f697f50df6ee}

It is very likely one of them is the box you lost. In my case it was the second last one.


Take note of the id (The value in the brackets)

Step 2:

Navigate to the base of your homestead box, ie that is where you normally start your box from.

From there you need to edit the id file ie

vim {PATH_TO_HOMESTEAD}/.vagrant/machines/default/virtualbox/id


Step 3:

Replace the value in the id file with a value of one of the previous instances and save.

Step 4:

Restart homestead.

This steps helped me recover a lost instance.

All the best 🙂