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.

Quickly dd anything from the commandline

Original – by Freek Van der Herten – 2 minute read

Laravel's tinker command allows to run any code you want as if you are inside your Laravel app. But if you want to run a single line of code if can be a bit bothersome. You must start up tinker, type the code, press enter, and quit tinker. Our new spatie/laravel-artisan-dd package contains an…

Read more

A tool for making JavaScript code run faster

Link –

Even though I'don't like Facebook as a user, their amazing contributions to open source are something to be very grateful for. Last week they presented their new work in progress: Prepack.

Prepack is a tool that optimizes JavaScript source code: Computations that can be done at compile-time instead of run-time get eliminated. Prepack replaces the global code of a JavaScript bundle with equivalent code that is a simple sequence of assignments. This gets rid of most intermediate computations and object allocations.

https://prepack.io/

It's still in development, so best not use it in production environments yet.

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.

Expressive Code & Real Time Facades

Link –

In a new post on his blog Taylor Otwell gives a nice example on how real time facades can make code more testable.

Recently, I worked on some code that surfaced my most common use-case for Laravel 5.4’s “real-time” facades. If you’re not familiar with this feature, it allows you to use any of your application’s classes as a Laravel “facade” on-demand by prefixingFacades to the namespace when importing the class. This is not a feature that is littered throughout my code, but I find it occasionally provides a clean, testable approach to writing expressive object APIs.

https://medium.com/@taylorotwell/expressive-code-real-time-facades-41c442914291

Read more

PHP Versions Stats - 2017.1 Edition

Link –

Jordi Boggiano, co-creator of Composer / Packages, published some new stats on the usage of PHP versions. Great to see that PHP 7 overall now represents over 50%.

A quick note on methodology, because all these stats are imperfect as they just sample some subset of the PHP user base. I look in the packagist.org logs of the last month for Composer installs done by someone. Composer sends the PHP version it is running with in its User-Agent header, so I can use that to see which PHP versions people are using Composer with.

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

Read more

Conditionally pushing event listeners to queue

Link –

Mohammed Said, Laravel employee #1 and diver, explains how you can avoid pushing unnecessary jobs to a queue.

How many customers will reach the 10K purchase milestone? does it make sense to push a Job to queue for every single purchase while there's a huge chance that this job will just do nothing at all? IMHO this is a waste of resources, you might end up filling your queue with thousands of unnecessary jobs.

It might be a good thing if we can check for that condition before queueing the listener.

http://themsaid.com/conditionally-queue-listeners-laravel-20170505/

Read more

Using Guzzle 6 Middleware in a Laravel Application

Link –

Paul Redmond explains how you can use Guzzle 6' middleware to add a HMAC authorization header.

I prefer to keep my dependencies as up-to-date as possible so I decided to learn Guzzle 6 and become more familiar with the middleware. The concepts are pretty straightforward and I have a few patterns that I like to use when building out middleware within my Laravel applications.

https://medium.com/@paulredmond/using-guzzle-6-middleware-in-a-laravel-application-7fbd6d966235

Read more

Manage permission and roles in a Laravel app

Link –

A few week ago we released a new major version of laravel-permission. This package makes it easy to store permission and roles in the database. Our package plays nice with Laravel's Gate and has support for multiple guards.

In a new post on his blog Saqueib Ansari shows how you can create an interface to assign permissions and roles to a user using our package.

Laravel comes with Authentication and Authorization out of the box, I have implemented many role and permissions based system in the past, using laravel, it’s peace of cake. In this post, we are going to implement a fully working and extensible roles and permissions on laravel 5.4. When we finish we will have a starter kit which we can use for our any future project which needs roles and permissions based access control.

http://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4

Read more

Think you know the top web browsers?

Link –

Peter O'Shaughnessy, a developer advocate for Samsung, explains that your idea on which browsers are the most popular is probably wrong.

Our traditional idea of the top five browsers may be over-simplified, outdated and skewed.

Chrome, Firefox, Safari, IE/Edge, Opera… It is a common idea that these are the five “major browsers”. Our familiarity with them is comforting, but it might be a skewed and outdated view. Partly from our Western bubble and partly a hangover from the days of desktop dominance. Let’s take a look at some numbers so we can better represent the reality.

https://medium.com/samsung-internet-dev/think-you-know-the-top-web-browsers-458a0a070175

Read more

Moving from PHP (Laravel) to Go

Link –

Danny Van Kooten did an interesting experiment. He completely rewrote an Laravel app to a version in Go. In a post on his blog he shares some details about his project along with some benchmarks.

Earlier this year, I made an arguably bad business decision. I decided to rewrite the Laravel application powering Boxzilla in Go.

No regrets though.

Just a few weeks later I was deploying the Go application. Building it was the most fun I had in months, I learned a ton and the end result is a huge improvement over the old application. Better performance, easier deployments and higher test coverage.

https://dannyvankooten.com/laravel-to-golang/

Read more

Familiarity Bias is Holding You Back: It’s Time to Embrace Arrow Functions

Link –

I don't think that less lines of code automatically means code is more readable, but I'm a big fan of ES6' arrow functions. In this article Eric Elliott dives deep into them.

I also supect that your team would become significantly more productive if you learned to embrace and favor more of the concise syntax available in ES6. While it’s true that sometimes things are easier to understand if they’re made explicit, it’s also true that as a general rule, less code is better. If less code can accomplish the same thing and communicate more, without sacrificing any meaning, it’s objectively better.

https://medium.com/javascript-scene/familiarity-bias-is-holding-you-back-its-time-to-embrace-arrow-functions-3d37e1a9bb75

Let's hope we'll soon have array functions in PHP too.

Read more

A practical introduction to snapshot testing

Link –

While working a little bit on laravel-sitemap I decided to refactor the tests to make use of our own snapshot assertions package. The snapshot package enables you to generate snapshots with the output of your tests. On subsequent runs of those tests it can assert if the output still matches the contents of the snapshot.

In this video I demonstrate how the refactor of the tests of laravel-sitemap was done. (double-click on it to view it full-screen)

If you want to know more about snapshot testing, then read this blog post written by my colleague Sebastian. The refactor of the tests can be viewed in this commit on GitHub.

(Little note on the video itself: this is my first tutorial video I ever made. After recording it I noticed that I used a wrong ratio resulting in those black bars on the side. Ah well, you live you learn. Next time it will be better. For those interested, I used a Blue Yeti Pro mic to record my voice and ScreenFlow to record and edit the video.)

Read more

$PHP = ????;

Link –

Simon Yousoufov argues that PHP is going the way of the dodo.

It’s well known that PHP is a dead programming language and that its 22-year-old ecosystem is effectively useless now that we have Node and its fancy new asynchronous frameworks. Node’s superiority is evident because everyone knows that single-threaded, asynchronous, programs are better by default. Faster. Stronger, even.

https://medium.com/fuzz/php-a0d0b1d365d8

Read more

Building a desktop application with Electron

Link –

Electron is a library that enables you to create desktop apps with JavaScript, Html and css. If you're interesting in playing around with this cool technology check out this tutorial by Kristian Poslek.

In this article, I’ll try to guide you through the process of building a simple desktop application and touch on important concepts for building desktop application with JavaScript.

https://medium.com/developers-writing/building-a-desktop-application-with-electron-204203eeb658

Together with Marcel Pociot and the help of Alex Vanderbist I'm currently building my first Electron app. It's a bit too early to share any details about it except that we'll open source it (and it'll be free).

Read more

A conversation on laravel-html

Original – by Freek Van der Herten – 4 minute read

Hi, how are you? I'm fine thanks! How are you? I saw you released another package last week. Yup yup, you mean laravel-html, right? It was actually coded up by my colleague Sebastian, who did an awesome job. But why put out yet another html generator? Html generation is a solved problem, right? Yes,…

Read more