PHP: Use Redis as database in Lumen

If you try to open a Redis connection in Lumen and you get a “Fatal error: Class ‘App\Http\Controllers\Redis’ not found in” … or other errors that indicate that Redis is not available this tip maybe will help you:

Redis is not per default included in Lumen so you have to require it in your composer.json file. Add this two lines in the “require”-section of your composer file.

    "predis/predis": "1.1.*@dev",
    "illuminate/redis": "5.1.*"

If it still don’t work check if you have enabled the withFacades option in bootstrap/app.php … you should uncomment the line: $app->withFacades(); … but that won’t help :P

withFacades adds some facades but not all if you want a shortcut for Redis you must add following line below the withFacades-call in app.php:

class_alias('Illuminate\Support\Facades\Redis', 'Redis');

This is my test controller …

namespace App\Http\Controllers;
use Redis;

class TestController extends Controller
    public function timeline()
        $redis = Redis::connection();

Missing in Your Code Documentation


You comment your code, you log your commits and you document your database, architecture and other project stuff. But do you log and document your decisions?

Why should i do that?

You always should program for the next developer! So you have coding conventions, commit logs and comments in code for it. But even the cutest code can’t help the next developer to understand why you did the things you did. Commit logs are more useful in this context but usually very short and some data is missing.

When i look at code from others, some questions are often in my mind:

  • Why he did it like that?
  • It looks like an error but works?
  • Maybe it was intendiert to work like this?
  • Someone surly thought about that?

You cannot answer this questions alone, you walk over to the developer who made it and talk about the questions. Often he can’t really remember the topic and you hear answers like: “I am not certain but i think we did it like that because someone said something …”. Hmm okay, who is “someone” and what was the argument for or against it?

If you can figure it out, good. But usually you have to discuss the whole topic again and make a “new” decision.
You have to do so also if the developer is not available currently or he left the company.

What is a decision in this context?

It can be a technology decision like using frameworks or libraries. A decision in the area of software architecture or a simple coding decision. You every day make many of these, you can’t document all of them, but if you have to discuss it with one or more of your peers it’s worth to document the outcome.

Often decisions have to do with business logic, usually your product manager have to document such things, but to be on the safe side you should write it down in your documentation too.

How should i do that?

Document positive and negative decisions, the yea and ney sayers and their arguments for or against the topic and of course the date when you decided it. Some examples for larger and smaler decisions in prosa:

  • 2014/02/03: Let’s add a field “productId” to database-table “User”. @DerFichtl, @TylerDurdan think it’s not a good idea but the alternative would be complicated and hard to implement.
  • 2014/02/03: Flatrate vs. PPV: We implement flatrate, PPV is a nice idea but to early in our situation. @MrBlack, @MrPink, @MrWhite are for it. @MrYellow is doubtful because of competitors have already PPV. @MrBrown knows it’s more risky but thinks PPV would be the better choice.

If you like a more structured way to document such things, try a table.

Date Decision Yea Ney
2014/02/03 We make something really strange in this sprint!
  • It’s funny doing strange things. @MrBlack @MrWhite
  • No, wait a sprint, i am on vacation the next sprint. @MrBrown

What happens then?

Documenting things is only useful if you use it later for other decisions. It should be possible to find all your notes about a specific topic. If you discuss a new decision, look in your documentation if you have already talked about before, maybe it’s already clear what to do, maybe a new argument arise and you have to change your decision from past.

Pioneers Festival 2013: John Biggs from Techcrunch [Video]

John Biggs from Techcrunch talks about …

  • open source / open hardware
  • liking Beer and a bartender robot
  • why finding schematics is fun and not dead
  • commandlines are not dead
  • killing black boxes
  • his self repair fail of an ipad mini
  • getting (not) rich with a raspberry pi bitcoin miner
  • makerbars and hackathons

To be honest, until now i don’t know what about this talk was … but he is a funny guy … and bartender robots are really fucking cool …

Send SMS Around the World with PHP and Plivo

0.06 USD per SMS to Austria

    if(! empty($_POST)) {
        require_once 'plivo.php';
        $to = $_POST['To'];
        $from = '/* Plivo DID Number with SMS Support */';
        $text = $_POST['Text'];
        echo "<br/>Sent Message info:<br/><br/>To: $to<br/>";
        echo "From: $from  <br/>";
        echo "Message: $text <br/>";
        $auth_id = '/* Auth ID */';
        $auth_token = '/* Auth Token */';
        $p = new RestAPI($auth_id, $auth_token);
        // Send a message
        $params = array(
            'src' => "$from",
            'dst' => "$to",
            'text' => "$text",
            'type' => 'sms',
        $response = $p->send_message($params);
        if (array_shift(array_values($response)) == "202") {
            echo "<br/><br/>Message status: Sent";
        } else {
            echo "<br/><br/>Error: Please ensure that From number is a valid and sms feature enabled Plivo DID number";
<form action="?" method="post">
    To: <input type="text" name="To"><br />
    Message:<br />
    <textarea name="Text" rows="3" cols="30" >Message Text</textarea><br />
    <input type="submit" value="Send SMS">

WordPress Updates on Amazon EC2

The WordPress update function is very cosy and simple, if you can use it!

But per default php on ubuntu or Debian can’t use ssh2 connections and so do WordPress. There is just no option for ssh2 in the backend and no fields for a private-key. The easy solution is the “SSH SFTP Updater Support” plugin. It adds ssh2 support to the update screen (for the system and plugins) and you can choose then your PEM-file there or copy your key in a text-field for authorization.

This plugin should be the last one you have to install per hand …

Bildschirmfoto 2013-10-05 um 08.08.20

Startup Ideas I Don’t Wanna Do …

I always have so many ideas, but don’t wanna do it, here you have it …


1. Website: Table Broker

A website where you can reserve tables in your favorite bars or restaurants like you can do it already with cinema- or plane-seats. The website contains a search for restaurants by city and taste (Italian, Chinese, Burger, …) the next screen is a bird-view of the restaurant (remember the game pizza-connection?) where you can see reserved and free tables.

This solves some problems like: Call ten restaurants to find one with enough seats. Never get a bad place again. Restaurants get a online database with reservations and statistics. You can extend the whole thing with online-menu … maybe with pre-order. Create a database of restaurant visitors, combine it with foursquare … …


2. Consulting: Happy Employees

Aka employer branding, HR consulting. Know everything what people makes unhappy, jealous, unproductive and how to achieve the opposite. You need a deep knowledge in psychology, work environments and laws. You need to know everything of the employees of your customers. You have to fix workers problems and so you will help your customers to get happy people in their offices. More specific: Plan staff events, create good working environments, choose the right benefits or build an challenging training plan.


3. Cross Everything

I like the idea of bookcrossing … but i also have so many other stuff i don’t need any more … old video games, kitchen machines, magazines, gadgets … all stored in some cupboards around the flat. Hmmh i can try to sell it on craigslist or such a website, but i have to do it piecemeal … with risk not to get rid of it … very time-consuming.

Would be much nicer if there would be some public showcase where i just could put the stuff … maybe there is also something in it what i want. Maybe we should make a sort of club out of it: The showcases can only be opened with a keycard or app? Bookcrossing works, Cross Everything could work also!


What do you think? Do you like the ideas? Or not!


Lego: Breaking Bad

Das Wäscherei-Drogenlabor


Ding, Ding, Ding


node.js Getting Started

Beginner Guides and Tutorials


Hello World

var http = require('http');
var server = http.createServer(function(req, res) {
  res.end('Hello Http');


built-in –

Package Management and Repository

npm –

Monitoring and Autoreload

nodemon –

Libraries and Templating

underscore –
jade –
ejs –

Frameworks –
express –

Just do sudo apt get install python software…

Just do …

sudo apt-get install python-software-properties
sudo apt-key adv –recv-keys –keyserver 0xcbcb082a1bb943db
sudo add-apt-repository ‘deb precise main’

sudo apt-get update
sudo apt-get install mariadb-server

… and MySQL will be replaced with MariaDB!
(on Ubuntu Precise)

bye bye MySQL

Some interesting infos about PHP on nginx or…

Some interesting infos about: PHP on nginx or apache performance …

1. nginx + php is not faster than apache + php
2. .htaccess drops apache performance radical
3. yes, static content is very fast on nginx