Value Objects in Laravel 5 with Eloquent Done Right

 
23 Kudos
Don't
move!

Update April 25th, 2016: I don’t use Value Objects in Laravel anymore. Here’s why.

One idea of Value Objects is to restrict what a programmer can do within the model. For example, an EmailAddress value object cannot be set to an invalid email address.

The advantage is: Validation and consistency of the domain model.

With Laravel however, there are a few things to think about and it took me a while to figure out a good solution.

tl;dr:

  • Use a Mutator to enforce the type of a Value Object
  • Store your Value Object as native value in your Eloquent model
  • Use an Accessor to create a Value Object from the native value
  • Implement __toString() in your Value Object to allow toArray()
  • Use the JsonSerializable interface to allow toJson() conversion
  • Plus: Do all of this automatically without Mutators and Accessors

Continue reading Value Objects in Laravel 5 with Eloquent Done Right

Server Hangs or Crashes with large Piwik Installation

 
2 Kudos
Don't
move!

Update 01.06.2015: Issue still remains. The suggested fix in this post didn’t work for me.

I have a dedicated Linux server (Debian) that runs Piwik. It’s a fairly standard installation of the LAMP stack. My Piwik server tracks visitors on 5–6 websites and one of them is fairly large with thousands of visitors per day. In recent weeks, my Piwik server would sometimes just hang. Responses weren’t sent and thus, I have gaps in my visitors graph, which is pretty annoying.
Continue reading Server Hangs or Crashes with large Piwik Installation

Ejecta & Impact.js – Disable Game Center & In-App Purchase Capabilities

 
0 Kudos
Don't
move!

I made an app with Impact.js that did neither require the Game Center, nor In-App Purchases. If you disable the capabilities in your Xcode project, you’ll notice that the build fails with 11 linker errors:
Continue reading Ejecta & Impact.js – Disable Game Center & In-App Purchase Capabilities

Ejecta & Impact.js – Which Resolution for iPhone?

 
2 Kudos
Don't
move!

The official documentation of Ejecta is alright to get you started, but the stuff about retina and iPhone resolutions just gave me a headache, especially since I wanted to do a pixel-perfect game with no scaling. So I ran some tests and share them with you to save you the time.
Continue reading Ejecta & Impact.js – Which Resolution for iPhone?

Tutorial: Tetris with Impact.js

 
15 Kudos
Don't
move!

Tetris with Impact.js

A few weeks back I bought a license for Impact.js, a decent HTML5 game engine I enjoyed working with so far. I bought it to get back into game programming. What I like about HTML5 games is that they are extremely accessible. Everybody has a browser, nothing has to be installed and HTML5 games can be quite engaging.
Continue reading Tutorial: Tetris with Impact.js