Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthias Gutjahr mattsches

View GitHub Profile
@mattsches
mattsches / Roman.php
Created Jan 30, 2013
PHP Roman Numerals Code Kata solution. A collaborative effort of the people @ PHP User Group Rheinhessen, Jan '13.
View Roman.php
<?php
/**
* Converts Roman numbers to integers
*/
class Roman
{
/**
* @var array
*/
@mattsches
mattsches / configuration.yaml
Created May 8, 2017
Beispiel für RESTful Sensor in Home Assistant zur Abfrage des luftdaten.info API
View configuration.yaml
sensor:
- platform: rest
resource: http://api.luftdaten.info/v1/sensor/1777
value_template: >
{% if value_json is sequence %}
{% set sensor = value_json | last %}
{% else %}
{% set sensor = value_json %}
{% endif %}
{% for sdv in sensor.sensordatavalues %}
View laravel facades discussion.md

Found an example there is a thing in laravel called FormRequest. Sometimes, I need extra validation. So I need to use some service there somehow. What options I have

  1. facade
  2. service locator via app() global function
  3. I also have instance of container there via $this->container

which one is the best here? I suppose instance of container

I can't do constructor injection. Why? Because for me, it seams that there are too many arguments on the __construct method