Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Loïc Faugeron:
Mars Rover, Event Sourcing package
Jul 27, 2016 @ 11:51:05

Loïc Faugeron has continued his "Mars Rover" series in his latest post today. This series, based on a set of specifications from a development challenge. In this latest post he continues looking at event sourcing and creates a package to handle the eventing to make it more flexible and robust.

In this series we're building the software of a Mars Rover, according to the following specifications. It will allow us to practice the followings: Monolithic Repositories (MonoRepo), Command / Query Responsibility Segregation (CQRS), Event Sourcing (ES) Test Driven Development (TDD).

Up until now, we've implemented the first use case, "Landing a rover on Mars" [and] in the last article, we wrote some Event Sourcing code. [...] In this article, we're going to extract them from the navigation package and put them in their own event-sourcing package.

He starts by creating the package itself as a Composer package including the composer.json configuration and a few other files to have phpspec work correctly. He then adds the event-sourcing package to the main project and starts in on using phpspec to generate its basic files. He then updates the main Lander class to use this new package for events. There's no code in the eventing classes yet, but stay tuned for the next tutorial in the series that will update them and get it all working together.

tagged: mars rover tutorial series landing event sourcing package phpspec

Link: https://gnugat.github.io/2016/07/27/mars-rover-event-sourcing-package.html

Loïc Faugeron:
Mars Rover, Landing event
Jul 20, 2016 @ 09:33:05

Loïc Faugeron has posted the latest tutorial in his series about developing a "Mars Rover" script using various design patterns and principles. In this latest part of the series he looks at handling the "landing event" of the rover.

In this series we're going to build the software of a Mars Rover, according to the following specifications. [...] Previously we've created a navigation package, and in it a LandRover class that validates input parameters for our first use case. [...] We've then refactored it to extract coordinates and orientation in their own classes.

In this article we're going to create the actual landing logic, using Event Sourcing

He then starts in, creating the tests first because of TDD, on the LandRoverHandler to integrate a command architecture (using the Command Bus pattern). He then sets up the structure for the event sourcing and an basic event for the landing of the rover. This includes the handler for the event, the event itself and the storage method for capturing that the event happened. He fills in the generated classes with a bit of logic and a few updates to the test for the new structure.

tagged: mars rover tutorial series landing event sourcing orientation phpspec

Link: https://gnugat.github.io/2016/07/20/mars-rover-landing-event.html

SitePoint PHP Blog:
Powering Raspberry Pi Projects with PHP
Jul 13, 2016 @ 12:20:52

The SitePoint PHP blog has posted a tutorial from author Andrew Carter showing you how you can use the Raspberry Pi hardware to power a PHP-based application with a bit of simple setup.

A Raspberry Pi is a brilliant tiny computer that you can power off of a micro USB cable. The most recent model has WiFi, an ethernet port, 4 USB ports and an HDMI port. There’s also a micro SD card slot, which is where the “hard drive” goes.

It’s capable of running Raspbian Linux, which is a Debian based Linux distribution. This makes it familiar to Ubuntu users who can then just sudo apt-get install all the things. Like with any Linux machine, you can install PHP on it and make a website – but we can do so much more than that!

He starts with the equipment you'll need to follow along with the tutorial - a recent Raspberry Pi model with wifi and a bit of other electronics equipment (he also recommends a starter kit for those new to this hardware world). Once the Pi is set up, he then installs PHP via an apt-get package install along with the PiPHP: GPIO library that makes working with the input/output simpler via PHP. He then shows the wiring you'll need to do to get a LED and button connected. A simple script is included that sets up a watcher on the button input and, when the "push" event is fired, it blinks the LED five times.

He finishes the post with a look at some of his own testing and preparation for a talk on this same subject with some slightly humorous results.

tagged: raspberrypi project tutorial piphp gpio hardware led button listener event

Link: https://www.sitepoint.com/powering-raspberry-pi-projects-with-php/

SitePoint PHP Blog:
PHP, Arduino, And… Minecraft? Connecting an Arduino to PHP!
Jul 12, 2016 @ 10:39:38

The SitePoint PHP blog has continued their series looking at connecting the real world with the online world via Minecraft and an Arduino. In this new post author Christopher Pitt picks up where he left off in part one and brings the Arduino in to the picture.

In the first part of this series, we learned a bit of Minecraft and the circuitry we can make inside it. We also made a circuit to alert us when the door to our mansion was opened. We then hooked this virtual alarm to a listening PHP script, so we can know when the door is opened in the context of a PHP script.

In this part, we’ll build a small Arduino-based alarm circuit. We’ll learn how to trigger the alarm, using the the official IDE and programming language, and then using something called Firmata. We’ll round the series out by connecting the alarm circuit to the Minecraft circuit, so we hear a real alarm for Minecraft mansion.

He takes some time at the beginning of the post introducing the Arduino hardware and what they have to offer. He lists the parts you'll need for this setup to work and how they need to be set up. He then gets into the code for the Ardunio side and how to get it over to the board. He presents another option to the potentially painful change-reupload cycle of debugging Arduino code: using the PHP "carica/firmata" library to connect to and add listeners to hook into the board. He uses this to then set up a PHP script to watch for changes in the Minecraft log files and fire an event to the waiting Arduino board.

The final item in this part of the tutorial series talks about bringing in the "Gorilla" extension for Carica Firmata to help prevent issues with too fast connections to the board interrupting the boot sequence.

tagged: tutorial series part2 minecraft arduino alarm connecting event loop

Link: https://www.sitepoint.com/php-arduino-and-minecraft-connecting-an-arduino-to-php/

Symfony Blog:
Announcing the Fourth Symfony Docs Hack Day
May 13, 2016 @ 09:58:29

On the Symfony Blog they've posted the official announcement of their Fourth Symfony Docs Hack Day happening on May 21st. This hack day is focused on just improving the documentation for the framework, not handling bugs in the main codebase itself.

The Symfony project is proud to announce its fourth Symfony Docs Hack Day. This Hack Day will be an online event to give a push to the Symfony Docs before the Symfony 3.1 release at the end of this month.

[...] Hosts Ryan Weaver, Wouter de Jong and Christian Flothmann along with you and all your friends from the Symfony community. The Hack Day is for everyone - we need Symfony experts and newcomers. If you're new to Symfony, you give us a fresh look at the documentation!

The post gives you a bit of an idea what the event will be like and what you can expect, especially as a first time submitter. It will be happening completely online via the "#symfony-docs" channel on the Freenode IRC network. You can prepare by following some of the links in the post to pending pull requests and a list of missing documentation contents.

tagged: symfony hackday documentation update event irc freenode framework

Link: http://symfony.com/blog/announcing-the-fourth-symfony-docs-hack-day

Joshua Thijssen:
My guide to commenting on joind.in
Dec 21, 2015 @ 10:44:16

If you've been to any PHP conference (or attended a PHP-related online event) in recent years, you probably have heard of the speaker/event feedback site Joind.in. The concept is simple: when you attend a talk or event you go to the site, give the speaker a star rating and leave them comments. This gives the speakers direct feedback on how they did and where they can improve. There's a a trick to giving valuable feedback, though, and Joshua Thijssen has posted some helpful tips to guide you and your comments in the right direction.

The joind.in website can be considered a presenter’s portfolio: it contains a list of talks they have done in the past (and where), plus it contains reviews from attendees. [...] This is why many conferences and presenters will talk about joind.in and ask you to rate and comments on their talks: it gives them feedback on how you experienced the talk, what can be improved to make it even better, and gives the presenters more chance to get accepted on even the larger conferences, where sometimes there are only 50 slots, but over 500 people submitted talks).

[...] Even though commenting and rating talks by itself isn’t really difficult and is quick to do so, there are some common “mistakes” and pitfalls which I’d like to discuss.

He breaks it down into five main points, elaborating on each as he goes through them:

  1. Stars don’t tell you everything
  2. Rate the presentation and speaker, not your expectations.
  3. Don’t punish the presenter for external faults
  4. Comment anonymously
  5. Give suggestions on how to improve

For each one he also gives examples of good feedback versus comments that aren't as helpful to the speaker. Each one of these is an easy trap to slip in to, so remember them next time you're giving a speaker feedback (even if it's not on Joind.in!).

tagged: speaker feedback useful commenting joindin event conference guide

Link: https://adayinthelifeof.nl/2015/12/17/commenting-on-joindin.html

Hart KT:
Custom Events in Symfony2 Bundle
Oct 12, 2015 @ 11:10:58

Hari KT has a quick tutorial posted to his site showing you how to use custom events in Symfony bundles from start to finish.

In this tutorial we will create a custom event for symfony2 bundle. Assuming you have downloaded the symfony-standard distribution to play.

He starts by creating a simple bundle (HktEventBundle) and building out the matching event class, extending the base Symfony EventDispatcherEvent. He then shows how to dispatch a simple event from a controller, triggering a html.event.page_viewed event when the request is made to this default controller. He matches this with a listener that subscribes to the event (including a handler method) and the changes you'll need to make to your configuration to wire them all together.

tagged: symfony2 bundle custom event simple tutorial introduction

Link: http://harikt.com/blog/2015/10/11/custom-events-in-symfony2-bundle/

SitePoint PHP Blog:
An Introduction into Event Loops in PHP
Sep 10, 2015 @ 10:06:55

The SitePoint PHP blog has posted a tutorial from Christopher Pitt introducing you to using event loops in PHP, a feature that allows for asynchronous processing, executing code while waiting for other code to finish.

PHP developers are always waiting for something. Sometimes we’re waiting for requests to remote services. Sometimes we’re waiting for databases to return rows from a complex query. Wouldn’t it be great if we could do other things during all that waiting?

If you’ve written some JS, you’re probably familiar with callbacks and DOM events. And though we have callbacks in PHP, they don’t work in quite the same way. That’s thanks to a feature called the event loop.

He starts by explaining event loops with an example from a language that naturally supports it - Javascript. He includes another example using the setTimeout function in Javascript to show a simple loop but points out that PHP just doesn't support this same kind of handling (code included). So, how can you simulate the loop like in JS? He links to and includes a examples of two libraries that could be dropped in and used to do the hard work behind the scenes of the looping:

He suggests that PHP developer "get out of the single threaded mindset" and work in ways to handle asynchronous processing into their code to improve performance and flexibility.

tagged: event loop javascript library icicle reactphp asynchronous processing

Link: http://www.sitepoint.com/an-introduction-into-event-loops-in-php/

SitePoint PHP Blog:
PHP Summer Camp 2015 Review
Sep 04, 2015 @ 10:55:15

The SitePoint PHP blog has posted an article from editor Bruno Skvorc reviewing the latest edition of the PHP Summer Camp conference that recently happened in Croatia.

You’re standing on a long pier, the last ten meters of which curiously belong to international waters despite being well inside the current country’s territory. As you climb the meter-high rock wall that forms a small barrier towards the west, you’re able to witness the sun dipping into the sea, far in the distance. Soft waves caress the rocky surface below your feet, bobbing the sea urchins and fish to and fro. There are other people there, each immersed in their own thoughts. No, that’s not a Dungeons and Dragons session starting. It’s the end of a great conference of workshops in Rovinj, Croatia, in the same spirit as [last year’s](http://www.sitepoint.com/phpsummercamp-review).

The PHP Summer Camp was made up of three tracks - two general PHP and one related just to eZ Publish. Bruno starts with a few of the key take-aways that he learned at the event before getting into reviews of each workshop he attended. He goes through each one describing what the session was about and some of the good/bad aspects he noticed. He also shares a "technical realization" he though of during the event around the use of Vagrant and provisioning virtual environments for the attendees. Finally he covers some of the "extras" like the early morning "triathlon" and evening events.

tagged: phpsummercamp15 conference wrapup review event sessions workshops

Link: http://www.sitepoint.com/php-summer-camp-2015-review/

Stefan Koopmanschap:
WeCamp Wrap-up (Days 1 - 5)
Sep 01, 2015 @ 12:37:21

For those that couldn't attend this year's WeCamp conference but wanted to get an idea of what it was like, I'd suggest checking out Stefan Koopmanschap's five part series if his experiences there. This year he participated as a coach rather than just an attendee so his perspective changed a bit.

He's posted summaries from each day of the event, chronicling their journey from a group of unknowns to a cohesive team with a finished project by the end of the event:

The WeCamp "conference" is more of a large hackathon where teams are camping on an island for the duration. They form random teams the first day and come up with a product idea to take to fruition over the course of a few days. If you're interested in the event and want to learn more about future plans, be sure to check out the main conference site.

tagged: wecamp15 conference event coach stefankoopmanschap

Link: http://leftontheweb.com/blog/categories/wecamp15/