Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

How I Built The LaravelQuiz Chatbot With BotMan and Laravel

Link –

Christopher Rumpel created a cool BotMan powered quiz on Laravel take you can take via Telegram. In a new blogpost he shares how it was built.

Hey everyone. In this article, I want to show you how I built the LaravelQuiz Chatbot. If you haven't tried it yet, it is a good idea to check it out before reading this article. This will help to understand what I am talking about. Right now it only supports Telegram. The chatbot provides a quiz with all kinds of questions about the Laravel framework. Every question comes with up to three possible answers. You need to pick the right one to collect points and make it to the highscore. But besides the ranks, the quiz is about having a good time. Enjoy the questions and see what you know about Laravel. Have fun!

https://christoph-rumpel.com/2018/05/how-i-built-the-laravelquiz-chatbot-with-botman-and-laravel

I took the quiz and scored pretty good.

Read more

Creating custom @requires annotations for PHPUnit

Link – mattstauffer.com

In an older but still relevant blogpost Matt Stauffer explains how you can extend PHPUnit's native @requires annotation. It's pretty handy if you want to only run certain tests in certain environments.

I was primarily interested in learning—how do PHPUnit annotations work? What does it look like to extend a pre-existing annotation? How do you not just check for the annotation, but also check its value? I'll show you what I found and then you can run willy-nilly with your own naming schemes.

Read more [mattstauffer.com]

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Visual Regression Testing with Laravel

Link – marcelpociot.de

Marcel Pociot, the mind behind BotMan, has released a cool package to create visual diff in your PHPUnit tests. Under the hood it uses our Browsershot package.

I'm not sure how you feel, but I consider myself a backend developer. Sure - I know my way around Vue.JS and really enjoy working with it, but writing CSS has never been my strong point. At one of our companies recent projects, we are working together with another development team, which is mostly taking care of frontend development. So we build controllers, repositories, services, etc. and hand it over to some basic views. They handle the rest. We introduced continuous integration to them and showed them our usual workflow, when I thought that it would be excellent to also have some kind of visual CI for frontend changes.

Read more [marcelpociot.de]

Vue templates in JSX

Link – sebastiandedeyne.com

My colleague Sebastian has been busy creating some low level Vue components for a client project. For these components he use JSX.

In my most recent project at work, I'm experimenting with JSX templates in Vue. Vue offers first-party support for JSX with near-zero configuration, but it doesn't seem to be commonly used in the ecosystem. I'm going to share my initial thoughts on using JSX with Vue. I'll be posting side-by-side examples of Vue templates and their JSX counterparts.

Read more [sebastiandedeyne.com]

A package that makes event sourcing in Laravel a breeze ?

Original – by Freek Van der Herten – 11 minute read

In most applications you store the state of the application in the database. If something needs to be changed you simply update values in a table. When using event sourcing you'll take a different approach. All changes to application state are stored as a series of events. The key benefit here is…

Read more

When empty is not empty

Original – by Freek Van der Herten – 2 minute read

Recently when I was working on a project I got some strange results when using the empty function. Here's what I was debugging. I've simplified the code a bit to share with you. var_dump( $person->firstName, empty($person->firstName) ); This was the result: string(5) "Freek"…

Read more

PHP Versions Stats - 2018.1 Edition

Link –

Like he already did a few times in the past, Composer co-creator Jordi Boggiano published some interesting statistics on PHP version usage as measured by Packagist.

A few observations: PHP 7.1 is still on top but 7.2 is closing real quick with already 1/5th of users having upgraded. That's the biggest growth rate for a newly released version since I have started collecting those stats. Ubuntu 18.04 LTS ships with 7.2 so this number will likely grow even more in the coming months.

https://seld.be/notes/php-versions-stats-2018-1-edition

Read more

Refactoring Vue: cleaning up a list of posts with better component splitting and more ES6

Link –

Matt Stauffer shares some interesting refactors suggested by his co-workers on a Vue component he wrote.

I've written some Vue since 2015, but I've also learned some React, written a lot of Laravel, run a company, and spent much of my free time writing a book about Laravel. It's time for me to get back into Vue.js and really spend some time to get good at it. Thankfully, some of the best Vue developers out there work at Tighten, so I'm putting them to work to level me up. So, I'm going to be writing new Vue code and also cleaning up some of my Vue from 2015, and I wanted to share the process with you, my lovely readers.

https://mattstauffer.com/blog/refactoring-vue-cleaning-up-a-list-of-posts-with-better-component-splitting-and-more-es6/

Read more

A newsletter about programming, design, and other related topics

Link –

My colleague Sebastian started a new side project: a newsletter about programming, design, and other related topics.

Growing the Stack is a biweekly—as in, once every two weeks—newsletter about programming, design, and other related topics. The newsletter isn't tied to any programming language or ecosystem, and it's not meant keep you up to date with all the new & shiny tools out there. It tries to bundle content that inspires. Content that triggers you to consider and try out new ideas.

Subscribe here: https://sebastiandedeyne.com/newsletter

Read more

Practicing symmetry

Link –

In a new video Jason McCreary, the creator of the wonderful Laravel Shift, demonstrates a few good tips to clean up code. In the video below Jason uses a code snippet taken from my side project Oh Dear!

If you're interested in more tips from Jason be sure to check out his upcoming BaseCode field guide.

Meanwhile I've cleaned up (and deployed) the code in the actual app. This is what I ended up with:

class Check
{
    public function needsToRun(): bool
    {
      if (!$this->belongsToTeamOnActiveSubscriptionOrOnGenericTrial()) {
          return false;
      }
			
      if ($this->disabled()) {
          return false;
      }
			
      if ($this->alreadyRunningOrScheduled()) {
          return false;
      }
			
      if ($this->didNotRunBefore()) {
          return true;
      }
			
      if ($this->checkType()->is(CheckType::UPTIME) && $this->latestRun()->failed()) {
          return true;
      }
			
      if ($this->previousRunCrashed()) {
          return true;
      }
      return $this->latestRun()->endedMoreThanMinutesAgo($this->checkType()->minutesBetweenRuns());
    }
		
    protected function checkType(): CheckType
    {
        return new CheckType($this->type);
    }  
}
use MyCLabs\Enum\Enum;

class CheckType extends Enum
{
    const UPTIME = 'uptime';
    const BROKEN_LINKS = 'broken_links';
    const MIXED_CONTENT = 'mixed_content';
    const CERTIFICATE_HEALTH = 'certificate_health';
    const CERTIFICATE_TRANSPARENCY = 'certificate_transparency';
    public function minutesBetweenRuns(): int
    {
        if ($this->getValue() === static::MIXED_CONTENT) {
            return 60 * 12;
        }
				
        if ($this->getValue() === static::BROKEN_LINKS) {
            return 60 * 12;
        }
				
        if ($this->getValue() === static::CERTIFICATE_HEALTH) {
            return 5;
        }
				
        if ($this->getValue() === static::UPTIME) {
            return 3;
        }
				
        throw new Exception("Minutes between runs not specified for type `{$this->getValue()}`");
    }
    public function is(string $type): bool
    {
        return $type === $this->getValue();
    }
}

Read more

Event sourcing made simple

Link –

The team at Kickstarter made a simple, synchronous event sourcing library implemented in Ruby.

We’ll go over a high level introduction to Event Sourcing where we will highlight the four components that make a (minimal) Event Sourcing system: Events, Calculators, Aggregates and Reactors. We will then talk about how we implemented a (minimal) Event Sourcing Framework at Kickstarter for d.rip. And finally we’ll reflect a bit on the ah-ha moments and the challenges that we’re going through with this approach — 9 months after having started to work on d.rip and 4 months after launch.

https://kickstarter.engineering/event-sourcing-made-simple-4a2625113224

Read more

Tidy up your tests with class-based model factories

Link –

John Bonaccorsi, a developer from Tighten, wrote some good ways of structuring model factories in a Laravel app.

Thanks to class-based model factories, our test setup went from being a bloated mess to simple and succinct. The optional fluent methods give us flexibility and make it obvious when we are intentionally changing our world. Should you read this blog post and immediately go and update all of your model factories to be class-based instead? Of course not! But if you begin to notice your tests feeling top heavy, class-based model factories may be the tool to reach for.

https://tighten.co/blog/tidy-up-your-tests-with-class-based-model-factories

Read more

A good issue

Link –

Sebastian De Deyne, package creator and JavaScript wizard at Spatie, gives some good tips on how to report an issue well.

Maintaining a number of open source projects comes with a number of issues. Reporting a good issue will result in a more engaged approach from project maintainers. Don't forget: there's a human behind every project.

https://sebastiandedeyne.com/posts/2018/a-good-issue

Read more