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.
- 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
__toString() in your Value Object to allow
- Use the
JsonSerializable interface to allow
- Plus: Do all of this automatically without Mutators and Accessors
Continue reading Value Objects in Laravel 5 with Eloquent Done Right
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
This is how I find some (not all) backlinks to my website. I do a Google search that looks for the URL of the post I want to find minus my own domain, like so:
Continue reading The Cheapskate’s Way to Find Backlinks to Your Website
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
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?
I’m working with ZfcTwig on a project and I was wondering how one could disable autoescape for all templates in the configuration. Since the documentation of ZfcTwig is not the best and I’m new to it, it took me a moment to figure it out.
Continue reading ZfcTwig: Disable Autoescape in Config
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
I worked endless hours to make FPDF display Chinese characters and whoever out there finds this article, I hope I can save you a few hours. Please consider this as a loose collection of tips and not as a complete tutorial.
Continue reading FPDF and Chinese Characters