Sevalla is the all-in-one PaaS for your web projects. Host and deploy your applications, databases, object storage, and static sites. Enjoy advanced deployment pipelines, a complete database studio, instant preview apps, and one-click templates. The pricing is simple: no hidden fees, no seat-based pricing, and you pay only for what you use. Get real human support from developers.

Get started now with a $50 credit at Sevalla.com.

A package to determine which track a last.fm user is playing

Original – by Freek Van der Herten – 1 minute read

If you've been reading the last couple of posts on this blog then you'll know we're busy building a dashboard. I think it's fair to say that everyone at Spatie is music addict. We have the unwritten rule that whoever who comes in first at the office is DJ for the day. One of the things we'd like to…

Read more

Dealing with workaholism on web teams

Link –

Yiannis Konstantakopoulos, a designer at Porcupine Colors, wrote an excellent piece on workaholism.

Workaholism is often confused with hard work. Some people who work on the Web seem not only to disregard its dangers, but to actively promote it. They see it as a badge of honor — but is it really? On the contrary, it’s a serious issue that can damage Web teams.

Before we get started, let’s make one thing clear: A “workaholic” is someone who is addicted to work, someone who is out of balance and out of control. Their addiction can make them work for 12, 14 or even more hours a day, every day. No weekends, no vacations, just work. Soon, they neglect their family, friends, health, sometimes damaging them all irrevocably.

https://medium.com/@porcupine/dealing-with-workaholism-on-web-teams-d6e156d82a08#.jyzawevsb

Read more

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.

A package to manage events on a Google Calendar

Original – by Freek Van der Herten – 3 minute read

Like previously mentioned we're currently building a new dashboard to display on our wall mounted TV at the office. One of the things we want to show on that dashboard are important events for our company. Things like when a site goes live, when there's a conference we're going to visit, when we're…

Read more

Finding differences in images with PHP

Link –

Over at Sitepoint Christoper Pitt shares some research he has done in finding differences in images using PHP.

I recently stumbled across a fascinating question: how could I tell whether an image had changed significantly? As PHP developers, the most troublesome image problem we have to deal with is how to resize an upload with an acceptable loss of quality.

In the end I discovered what many before me have – that this problem becomes relatively simple given the application of some fundamental mathematical principles. Come along with me as we learn about them…

https://www.sitepoint.com/finding-differences-in-images-with-php

Read more

Getting package statistics from Packagist

Original – by Freek Van der Herten – 2 minute read

At my work I'm currently creating a new dashboard. That's a fancy term for an html page sprinkled with some Vue magic that will be displayed on tv screen at the wall of our office. I won't say much about the dashboard itself on this post, but I'll make sure to write something on that in the near…

Read more

Anonymous classes benchmarked

Link –

Mark Baker made some fascinating benchmarks on the performance of PHP 7's anonymous classes.

A week or so ago, I published an article entitled “In Search of an Anonymous Class Factory” about my efforts at writing a “factory” for PHP7’s new Anonymous Classes (extending a named concrete base class, and assigning Traits to it dynamically); and about how I subsequently discovered the expensive memory demands of my original factory code, and then rewrote it using a different and (hopefully) more memory-efficient approach.

Since then, I’ve run some tests for memory usage and timings to assess just how inefficient my first attempt at the factory code was, and whether the new version of the factory really was better than the original.

https://markbakeruk.net/2016/05/12/anonymous-class-factory-the-results-are-in/

Read more

Acceptance Testing a Laravel and Vue.js Application

Link –

Mohammed Said did some research on how run acceptance test for a javascript driven interface.

If you’re testing non-javascript driven interfaces then you may use Laravel’s built-in PHP Browser based testing library, it’s very powerful and the API is very readable as well. However if you need to test javascript driven interfaces then selenium is what you should be using.
https://dotdev.co/acceptance-testing-a-laravel-and-vue-js-application-4160b8e96156#.j1ltb34zv

Read more

SQL injection via the user agent HTTP header

Link –

Over at the CloudFlare blog John Graham-Cumming wrote an interesting article on SQL injection attacks via http request headers.

SQL injection is a perennial favorite of attackers and can happen anywhere input controlled by an attacker is processed by a web application. It's easy to imagine how an attacker might manipulate a web form or a URI, but even HTTP request headers are vulnerable. Literally any input the web browser sends to a web application should be considered hostile.
https://blog.cloudflare.com/the-sleepy-user-agent/

Read more

CSI: PHP

Link –

Jeremy Kendall dissects bad PHP code on his site csiphp.com.

It all began with a new gig and an amazingly horrific codebase. I began tweeting the most unbelievable, most frustrating snippets I could find. After quite a few of those tweets, Chris Hartjes replied with, “Looking at your tweets I cannot even fathom what your job is. CSI:PHP?” A concept was born.

Twitter’s 140 characters are rarely enough to share the horrors of bad code, and I don’t want to give short shrift to the nefarious and misguided scripts that I’ve found. Behold the CSI: PHP blog, where I investigate criminally bad codebases and share the evidence with you, my fellow developers.

http://csiphp.com/

Read more

Improving the speed of a MySQL import

Link –

A few weeks ago Gabriela D'Ávila helped a famous guy with getting an MySQL import down from 16 to 6 minutes. In a post on her blog she explains how that was done.

A few weeks ago my friend Frank de Jonge told me he managed to improve an import into a MySQL server down from more than 10 hours to 16 minutes. According to him it had something to do with one of the field types (too long fields to really small data) and the amount of indexes and constraints in the tables. We were talking about 1 million records here. He wondered if it was possible to make it even faster.

...

Turns out there are many ways of importing data into a database, it all depends where are you getting the data from and where you want to put it.

http://gabriela.io/blog/2016/05/17/fast-data-import-trick/

Read more

What does it take to be a great developer?

Link –

Eric L. Barnes asked this question to people with several backgrounds.

I love questions that can’t be answered with a simple yes or no. One question that I have been thinking about recently is, just what does it take to be a great developer?

I came up with tons of answers but felt like mine are all through my own lens, so I decided to reach out to a few people from different walks of life and just ask them. What follows is the answer by each person and their profession so you can compare and contrast.

https://dotdev.co/what-does-it-take-to-be-a-great-developer-a2eddb0c47e6#.sf8kwd8tv

Read more

Why I Haven’t Fixed Your Issue Yet

Link –

Michael Bromley on his blog:

There is an implicit agreement which needs to be understood by both consumers and creators of FOSS projects1. It goes something like this:

  • I agree to provide you with some free code which solves your problem.
  • I recognize that in doing so, I have taken on a small portion of responsibility to you as a user of my code.
  • I agree to try to help you if you have difficulty in using my code.
  • I agree to try to fix bugs that you find in my code.
  • Crucially, you agree that I, in acting without remuneration, am free to assign priority to the above points as I see fit.

The last point is the reason why I haven’t fixed your issue yet.

http://www.michaelbromley.co.uk/blog/529/why-i-havent-fixed-your-issue-yet

As a package consumer you should be grateful for the free code you're given. Keep in mind that when you use someone else's code, you are responsible for that code as well. If a package maintainer solves an issue for you that's great. If he or she doesn't, than that's your problem, not the maintainer's. You can always submit a PR with a fix. And if the fix or feature doesn't get accepted you can always maintain your own fork.

For our own packages we try to respond to every single issue in a timely manner. The users of our packages are generally very friendly and helpful. There's only one instance when things went sour. I do make a point of thanking everybody who takes the time to submit a PR. It's a small thing but I do believe it helps creating a positive vibe on our GitHub repo's.

Read more

Upcoming changes in PHP 7.1

Link –

Amo Chohan wrote a rundown of the big changes coming tot PHP 7.1

  • Catching multiple exception types
  • Curl HTTP/2 server push support
  • Support class constant visibility
  • Void return types
  • Generalize support of negative string offsets
  • Allow specifying keys in list() and square bracket syntax for array destructuring
  • Warn about invalid strings in arithmetic
  • Deprecate and remove mcrypt()
https://medium.com/@amo.chohan/upcoming-changes-in-php-7-1-76ebea53b820#.2udxw3qfe

Read more

Short list syntax for array destructuring approved

Link –

On dotdev.co Eric L. Barnes explains a new feature that is coming in PHP 7.1

With the accepted proposal it creates an alternative to using “list” for destructuring an array. In all previous versions of PHP this works like this: list($a, $b, $c) = array(1, 2, 3); Now you can extract using a square bracket just as you do for assignment: [$a, $b, $c] = [1, 2, 3]; ["a" => $a, "b" => $b] = ["a" => a, "b", => 2];
https://dotdev.co/php-unanimously-approves-short-list-syntax-for-array-destructuring-887208b661af#.58zwoz85l

Read more

PHP Session Garbage Collection: The unknown performance bottleneck

Link –

Here is one performance setting in your PHP configuration you probably haven't thought about much before: How often does PHP perform random garbage collection of outdated session data in your application? Did you know that because of the shared nothing architecture PHP randomly cleans old session data whenever session_start() is called? An operation that is not necessarily cheap.
https://tideways.io/profiler/blog/php-session-garbage-collection-the-unknown-performance-bottleneck

Read more

How to setup and use the Google Calendar API

Original – by Freek Van der Herten – 4 minute read

For a project I'm working on I needed to interact with a Google Calendar. If you've ever worked with some API's by Google then you know their documentation can be very confusing. It's not that they don't have documentation, but code examples of common use cases are simply not present. You must wade…

Read more

The magic behind Laravel Valet

Link –

Mohamed Said peeked behind the curtains and explains on his blog how Laravel Valet works behind the scenes.

The idea behind Valet is that it configures PHP's built-in web server to always run in the background when the operating system starts, then it proxies all requests to a given domain to point to your localhost 127.0.0.1
http://themsaid.github.io/magic-behind-laravel-valet-20160506/

If you want to keep Homestead around for some projects, know that your can also use dnsmasq to point an entire domain to your Homestead installation.

Read more