PHP 7.4 FFI: What you need to know

If you have ever looked at PHP’s documentation on how to write a native extension, you’ll know how needed this new PHP feature is. It will let you easily wrap highly optimised code and use it in your application to tackle those performance bottlenecks.

PHP Foreign Function Interface, or FFI for fans, is a PHP extension that allows you to include with ease some externals libraries into your PHP code. That means it’s possible to use C, Go, Rust, etc. shared library directly in PHP without writing a PHP Extension in C.

Read PHP 7.4 FFI: What you need to know on jolicode.com


More ways to write down IP addresses

Mattias Geniar shares multiple ways of writing IP addresses. One of them is with optional zeros, so 127.0.0.1 is the same as 127.1 🤯.

Most of us write our IP addresses the way we've been taught, a long time ago: 127.0.0.1, 10.0.2.1, ... but that gets boring after a while, doesn't it? Luckily, there's a couple of ways to write an IP address, so you can mess with coworkers, clients or use it as a security measure to bypass certain (input) filters.

Read There’s more than one way to write an IP address on ma.ttias.be.


The cost of parsing JSON

Interesting insights shared by the V8 team on the cost of parsing a JavaScript object literal versus a plain JSON string.

Because the JSON grammar is much simpler than JavaScript’s grammar, JSON can be parsed more efficiently than JavaScript. This knowledge can be applied to improve start-up performance for web apps that ship large JSON-like configuration object literals (such as inline Redux stores).

Read The cost of parsing JSON on v8.dev.


Going epic with Redux Observable tests

The last couple of React projects I’ve developed where built with a lot of help from the Redux Observable library. It is an excellent library to separate your business logic from your components, but the correct way to test is still something they need to find out. In this article, I am gonna share my ideas on this topic.

Keep reading


How I started thinking about my styles

If I had received a dollar for each time I intend to write the most maintainable CSS I had ever seen… We’ve all been there as front-end developers, right?

Since I started programming as a kid some years ago, let’s call it the table-layout era, things weren’t that hard. I created a single website with a single stylesheet and when it worked for me, it possibly worked for everybody. For real! Me and my friends were probably the only ones visiting the website anyway. And it was a fun and enjoyable thing to do.

Keep reading


JavaScript rendering in PHP with Lambda

As a web developer you’ve must came across the term Polymorphic Javascript, or Universal Javascript as some may prefer to call it. The technique behind it is even mentioned as “The Future of web apps”. So even for the PHP community it is hard to not stumble upon any buzz around it. In this article I’ll explain another solution that integrates into any PHP application very easily. It’s called Lambda and is a hot new AWS service.

Keep reading


Handle authenticated users in Behat/Mink

One of the latest addition to PHP’s testing tools is Behat. A test framework that focusses on business expectations (behavior driven development) versus the good ol’ unit tests of PHPUnit (test driven development). In short, with BDD you are describing your functionality instead of testing your functionality with TDD afterwards.

If you use Behat in combination with Mink, you can test the behaviour of your application in the browser. It simulates the interaction between users and your application. But what if you have any authentication mechanism in your application, do you need to go through the login form in any test? The answer is no. And in this article I’ll explain how.

Keep reading


Running Hapi with Passenger on Heroku

Before it changed it’s name to Passenger, the application server was called mod_rails and used as module within Apache HTTPD to get your RoR applications up and running.

What Passenger does is tuning itself automagically to get the most out of your server’s hardware. Like using all available CPU cores by default, HTTP caching without any configuration and load-balancing across the application’s processes. If you have ever ran Node.js in production, you’ll know how hard it is to tweak everything correctly according to the server it’s running on. So a little bit of help in this is always welcome.

Keep reading


Rendering templates from a Twig extension

Given you need to render something - a toolbar for example - inside your template in a Symfony application. You have some options to do this like creating a specific controller action. Embedding a controller action is already described thoroughly in the Symfony docs and seems to be the most legit answer on this topic in multiple StackOverflow questions. But there is another option; creating a Twig extension which facilitates a function to render your template. How to create such extension you ask? In this blog post I’ll explain how.

Keep reading


A spelling and grammar checker for Node

When you need to write in a foreign language, you’ll probably use Google Translate. An awesome service that does a great job for translating individual words. But what about the grammar of a sentence? Like for example ‘Edwards will be sck yesterday’. It will corrects ‘sck’ to ‘sick’, but it doesn’t correct ‘will be’ to ‘was’. Thankfully there are some other services for that and I created a Node wrapper for one of them. Say hello to Gingerbread.

Keep reading