PHPNews

BetterReflection version 2.0.0 released

Written by ocramius.github.io - Published on ocramius.github.io
Aggregated on Monday September 18, 2017 - Permalink

Roave 's BetterReflection 2.0.0s was released today! I and James Titcumb started working on this project back in 2015, and it is a pleasure to see it reaching maturity. The initial idea was simple: James would implement all my wicked ideas, while I would lay back and get drunk on Drambuie. Yes, that actually happened. Thank you, …

Continue reading »


Eliminating Visual Debt

Written by ocramius.github.io - Published on ocramius.github.io
Aggregated on Monday May 29, 2017 - Permalink

Today we're talking about Visual debt in our code. As an introduction, I suggest to watch this short tutorial about visual debt by @jeffrey_way . The concept is simple: let's take the example from Laracasts and re-visit the steps taken to remove visual debt. interface EventInterface { public function listen(string $name, callable …

Continue reading »


YubiKey for SSH, Login, 2FA, GPG and Git Signing

Written by ocramius.github.io - Published on ocramius.github.io
Aggregated on Saturday April 15, 2017 - Permalink

I've been using a YubiKey Neo for a bit over two years now, but its usage was limited to 2FA and U2F. Last week, I received my new DELL XPS 15 9560, and since I am maintaining some high impact open source projects, I wanted the setup to be well secured. In addition to that, I caught a bad flu, and that gave me enough excuses to waste …

Continue reading »


Fast PHP Object to Array conversion

Written by ocramius.github.io - Published on ocramius.github.io
Aggregated on Friday August 9, 2013 - Permalink

A couple of months ago, I found a forgotten feature of PHP itself. Apparently, it is possible to cast objects to arrays like following: <?php class Foo { public $bar = 'barValue'; } $foo = new Foo(); $arrayFoo = (array) $foo; var_dump($arrayFoo); This will produce something like: array(1) { ["bar"]=> string(8) "barValue" } Private and …

Continue reading »


Fluent Interfaces are Evil

Written by ocramius.github.io - Published on ocramius.github.io
Aggregated on Thursday November 7, 2013 - Permalink

Today, I had again a discussion on IRC on why Doctrine's EntityManager doesn't (and won't) implement a fluent interface. Here are my thoughts on why that's the case. Recap: What is a Fluent interface? A Fluent Interface is an object oriented API that provides "more readable" code. In general, the template for a fluent interface can be like following: …

Continue reading »


LazyProperty - Automatic property initialization for PHP

Written by ocramius.github.io - Published on ocramius.github.io
Aggregated on Wednesday February 19, 2014 - Permalink

Yesterday, I worked on yet another interesting little experiment, which is called LazyProperty . The problem with "lazy" properties The idea is very simple: avoid manually checking object properties to see if they were initialized. Let's make a simple example: <?php class UserService { // ... protected $userRepository; public function …

Continue reading »