Release Laravel jobs in queue without increasing attempts

Introduction

I’m currently working on a platform for processing videoclips. Our job is to extract as much information as possible (e.g. detect tags, detect faces, get dominant colors, etc.) out of each clip. Most of the heavy lifting is delegated to 3rd-party services, such as AWS Rekognition and Google Video Intelligence, which can provide the most “reliable” and cheap Machine Learning platform for this kind of tasks.

Without going too much into details, target videoclips …

Read More
Building a pagination component in Svelte

Introduction - What is Svelte?

Svelte is a (not so) new framework for building User Interfaces. It borrows some ideas from its more popular peers, like React and Vue.js, but it brings its own ideas into the mix, in order to maximize efficiency and performances.

Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your …

Read More
Require a local Composer package for development

Introduction

In PHP world Composer is currently the industry standard handling third-party packages. It allows us to automatically download the code libraries from Packagist along with all of their dependencies.

When developing a package that is going to be used in a framework, say Laravel for example, you don’t want to constantly push changes and require the package in a “real” project to test the integration. Wouldn’t be nice to include the local version of the …

Read More
Unit test Laravel pre-5.3 Queue facade

Introduction

This post is a followup of the previous one.

During my daily job I often work with old (pre 5.3) Laravel versions which do not provide fake implementations on facades, since this functionality has been introduced in version 5.3. For example with the Queue facade you can make the following assertions:

<?php

// Fake Queue functionality
Queue::fake();

// Perform order shipping...

Queue::assertPushed(ShipOrder::class, function ($job) use ($order) {
    return $job->order …
Read More
Unit test Laravel pre-5.3 Mail facade

Introduction

This post is only serving as a reference to how the Mail facade should be unit tested in Laravel versions previous to 5.3.


When testing an application we don’t want to send actual emails to users. We just want to fake them so we can ensure that they are getting sent, at some point, to the right users and with the right content.

Laravel provides Mail Fakes since version 5.3. This functionality allows you to easily mock the Mail facade and make various assertions on it. …

Read More
Use import aliases in Rollup module bundler

Introduction

Sometimes, when working with JavaScript and module bundlers, it’s useful to create aliases in order to import or require some modules more easily. In Webpack for example you can use the resolve.alias directive inside the configuration file.

module.exports = {
  //...
  resolve: {
    alias: {
      'applicationRoot': path.resolve(__dirname, 'src/')
    }
  }
};

A common use case for aliases is to abstract the application root, so instead of using relative …

Read More