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

Stephan Hochdöfer:
Dockerizing GitLab Review Apps
Jun 07, 2017 @ 10:28:15

On the BitExpert blog Stephan Hochdöfer has written up a post showing how to "Dockerize" GitLab review apps to create a consistent platform for these self-contained environments.

Last year GitLab introduced the Review Apps feature. Review Apps are app environments that are created dynamically every time you push a new branch up to GitLab. As a bonus point the app environments are automatically deleted when the branch is deleted. Since we moved to using docker for quite a few of our projects I was keen on figuring out how to combine Docker and the GitLab Review Apps functionality as the documentation only mentions NGINX as a way to run Review Apps. As it turns out, it is rather simple to deploy docker containers as a Review App.

He describes the environment he needs and which tools he'll be using to perform the build of the environments. He then defines the sample GitLab configuration file including the "build" stage. He briefly explains the steps this follows then shows the configuration for the "deploy" step, grabbing the latest image from his Docker repo and running it. He ends the post with an "undeploy" stage that removes the Docker build automatically when the environment is no longer needed.

tagged: gitlab review application apps tutorial docker deploy undeploy

Link: https://blog.bitexpert.de/blog/dockerizing-gitlab-review-apps/

Ian Cambridge:
Code Review: Single Responsibility Principle
Feb 23, 2017 @ 13:24:05

Ian Cambridge has put together a new post for his site focusing on the Single Responsibility Principle, one of the more well-known (and well understood) parts of the SOLID design principles.

Single Responsibility Principle (SRP) is probably one of the most well-known principles from SOLID. At its core is a desire to prevent classes from becoming overwhelming and bloated. While enabling the ability to change how a single thing works by only changing a single class. So the benefits of SRP are that you have an easier codebase to maintain since classes are less complex and when you wish to change something you only have to change a single class. In this blog, I will go through some ways to try and help avoid breaching SRP while doing code review.

He gives two examples and the code they might contain, breaking the SRP mentality. The first is a "manager" (or service) class that, while good in principle, usually ends up performing way too many operations than it should. The second is a "from usage" instance where the return of one method is being used as a parameter for another method in the same class. For each he talks about the problem with the current implementation and offers a suggestion or two of things to fix to make it adhere more to SRP ideals.

tagged: singleresponsibilityprinciple srp solid example code review

Link: http://blog.humblyarrogant.io/post/2017-02-21-code-review-single-responsibility-principle/

Laravel News:
Review: Refactoring to Collections
Feb 16, 2017 @ 10:45:33

The Laravel News site has posted a book review by Diaa Fares of Adam Wathan's "Refactoring to Collections" book.

“Never write another loop again.” A strong promo sentence used by Adam Wathan to market his Refactoring to Collections book, but does it hold the promise? Well, together we will explore how close that claim is to reality.

If you are a Laravel developer, chances are you’ve heard about the collection pipeline before. While I use it a little in my projects I hadn’t realized the possibilities of this approach until I read Refactoring to Collections. It brought me to another level of thinking about utilizing the power and capabilities of functional programming.

The review goes on to talk about imperative versus declarative programming (with examples) and how the book walks you through "the journey" to move to a collections-driven code structure. The review also points out the amount of concepts to learn in the book and the style/effort that was clearly put into its creation. It also points to this RFC as hope for the native use of "arrow functions" in PHP in the future.

tagged: refactor collections book review adamwathan

Link: https://laravel-news.com/review-refactoring-to-collections

Giorgio Sironi:
Book review: Fifty quick ideas to improve your tests
Feb 13, 2017 @ 11:15:03

Giorgio Sironi has posted a review of a book to his site that shares fifty quick ideas to improve your tests that can help with things like run time, ease of maintenance and following best testing practices.

Fifty quick ideas to improve your tests is, well, a series of fifty quick ideas that you can implement on some of your automated test suites to improve their value or lower their creation or maintenance costs.

These ideas are pattern-like in which they are mostly self-contained and often independent from each other. They are distilled from real world scenarios that the authors (David Evans, Tom Roden and Gojko Adzic) have encountered in their work.

He's included a few quotes from the book he found particularly interesting including mentions of:

  • a pyramid of software quality levels
  • misunderstanding that testing can somehow be completely replaced by a set of carefully chosen examples
  • difficult testing is a symptom, not a problem
  • the problem with time-based "sleeping" in tests

You can find the book itself over on Leanpub and can pick up your own copy for around $10 USD.

tagged: book review fifty ideas improve testing ebook leanpub

Link: http://www.giorgiosironi.com/2017/02/book-review-fifty-quick-ideas-to.html

Laravel News:
Review of Test-Driven Laravel
Dec 02, 2016 @ 10:44:56

The Laravel News site has posted a review of "Test Driven Laravel", a course from Adam Wathan walking you through the creation of a Laravel-based application from a completely Test-Driven Development approach.

I’ve been programming for close to a decade, and I’m constantly trying to find ways so to improve my skill set to be able to keep up with the ever-changing landscape of technology. The one area I’ve always wanted to improve in has been testing. [...] When Adam announced at Laracon that he was creating a course on building real-world applications with TDD, I was really excited to see where it would go.

Over the past couple of months, I’ve been lucky enough to preview the course as the lessons get finished. It’s been really helpful because I’ve been working on a large, complex application, and I’ve been able to apply the things I’m learning immediately in my day-to-day work.

The review goes on to talk about some of the things they've learned already from the course including test coverage for parts of the app that work with 3rd party services. They link to this talk from Adam as an example of some of the concepts taught in the course and, of course, a link where you can purchase your own Early Access pass and start learning.

tagged: review earlyaccess testdriven laravel tdd adamwathan testing course

Link: https://laravel-news.com/review-of-test-driven-laravel

SitePoint PHP Blog:
A Review of Bulgaria PHP – Game On!
Oct 12, 2016 @ 10:52:09

The editor of the SitePoint PHP blog, Bruno Skvorc, has posted a summary of his experience at Bulgaria PHP, a recent PHP conference held in Sofia, Bulgaria back in the beginning of October.

BulgariaPHP is a PHP conference consisting of one workshop day, and two talk days with two tracks each. Just like last year, this year’s conference happened in the SEC (Sofia Event Center) in Sofia, Bulgaria, on the top floor of the Paradise Mall. Unlike last year, however, this year’s edition had a theme.

Excellently organized by the event team at SiteGround, a shared and cloud hosting provider 500 employees strong, the conference was all up in retro gaming, from the attendee badges and decals, to the surroundings and micro-events within the event. Even the crew were all dressed as Super Mario, which I’m sure would have caused an aneurysm or two in the minds of Nintendo’s lawyers had they gotten wind of it.

He talks about his experience as both a speaker and attendee at this year's event (and how he felt "spoiled"). He covers some of the speakers that were at the event, the topics he personally learned about and how the conference itself was handled (sponsors, the theme and the charity the conference provided to a local school).

tagged: bulgariaphp conference bgphp16 review speaker attendee

Link: https://www.sitepoint.com/a-review-of-bulgaria-php-game-on/

Michelangelo van Dam:
PHPSrbija Conference 2016 review
Jun 02, 2016 @ 12:56:40

Michelangelo van Dam has posted a review of a recent conference he spoke at - the PHP Srbija Conference 2016. it shares a bit about the conference in general and some of his own experiences as a speaker.

This past weekend I was invited to speak at PHP Srbija Conference 2016 which was held in Belgrade, the capital of Serbia in the south-east of Europe.

He details some of the travels he took to get to the conference, some of the other speakers in attendance and the area where the conference was held. He also covers some of the sessions that were presenting including the keynote from Chris Hartjes and talks from PHP notables like Sebastian Bergmann, Rafael Dohms and Marco Pivetta. He makes a definite recommendation to attend future events to anyone out there not able to attend this year and how he felt privileged to be a part of this year's conference.

tagged: phpsrbija conference 2016 pc16 review speaker

Link: http://www.dragonbe.com/2016/06/phpsrbija-conference-2016-review.html

SitePoint PHP Blog:
Functional Prog, Distributed DBs, JSON-Patch and More!
Oct 07, 2015 @ 10:31:27

The SitePoint PHP blog has posted a wrapup/review of the WebCampZG conference that happened in Croatia back on October 3rd & 4th (2015). It's "an annual conference for web developers, held in Zagreb on the first weekend of October".

This weekend, Chris Ward (the mobile channel editor at SitePoint) and me attended [Webcamp ZG](http://www.sitepoint.com/webcamp-zagreb-2015-a-conference-you-must-not-miss), the annual international web-oriented conference in Zagreb, Croatia. [...] The conference is a two day event, each day spearheaded by a keynote type of talk before diving into the bulk of the content. The schedules of both days contained plenty of breaks with food, drinks and snacks scattered throughout, providing for both energy and excellent socialization and networking contexts.

He covers both days of the event, talking about the sessions that were presented (including one from SitePoint-er Chris Ward) and the evening activities that followed. Despite some missteps in session content and the wifi - always a problem at tech conferences - Bruno found the event "a blast" and plans on attending in the future.

tagged: webcampzg webcampzg15 zagreb croatia conference wrapup review

Link: http://www.sitepoint.com/functional-programming-distributed-databases-json-patch-and-more/

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/

SitePoint PHP Blog:
Writing PHP Git Hooks with Static Review
Sep 01, 2015 @ 11:16:01

On the SitePoint PHP blog Matthew Setter introduces the use of git hooks to help with automatic static analysis of your application's code, integrating it directly into your current workflow. He shows how to use this library to make creating and installing them as easy as a single command (and they're written in PHP).

If you’ve been using Git for more than a short length of time, you’ll hopefully have heard of Git hooks. [...] There are hooks for pre- and post-commit, pre- and post-update, pre-push, pre-rebase, and so on. The sample hooks are written in Bash, one of the Linux shell languages. But they can be written in almost any language you’re comfortable or proficient with. [...] Thanks to Static Review, by Samuel Parkinson, you can now write Git hooks with native PHP, optionally building on the existing core classes. In today’s post, I’m going to give you a tour of what’s on offer, finishing up by writing a custom class to check for any lingering calls to var_dump().

He walks you through the installation of the library and helps you create a simple working example that ensures you've correctly set up your (Composer) dependencies. He explains a bit about what's involved in the StaticReview package and the three "introspection" objects initialized for each run. He ends the post by walking you through the creation of a custom, more real-world check that evaluates your code (via a simple grep) to ensure no var_dump statements were left in.

tagged: static review git hook analysis tutorial

Link: http://www.sitepoint.com/writing-php-git-hooks-with-static-review/