How to build a cookieless Laravel app

dieterstinglhamber.me

At Spatie We are currenlty building a new company website. One of the cool features is that it won't set a single cookie. In a new blogpost Dieter Stinglhamber explains how you can achieve this in Laravel.

Since May 25th you have been harassed by "We have updated our privacy policy" emails but also websites started to great you with "Please, let us and our 256 partners track you". In response to these abusive practices, some developers have decided to follow a better path, removing every cookie that is not needed.

Read more [dieterstinglhamber.me]

How to compile an unreleased PHP feature

www.sammyk.me

Sammy Kaye Powers, the host of the PHP Roundtable podcast, wrote a blogpost on how to compile PHP from source including unreleased RFC's. After following this tutorial you'll be able to play with the [typed properties] that are currently under discussion.

We'll be discovering and testing a completely unreleased feature of php-src from an RFC that's still under discussion. If you've ever wanted to be ahead of the curve of PHP features or you've just wanted to contribute back to PHP internals, testing an unreleased feature from an RFC is a fun and educational way to do so.

Read more [www.sammyk.me]

Join 9,500+ smart developers

Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

Thoughts on PHP 8

externals.io

On the PHP internals mailing list Zeev Suraski, a long time core contributor of PHP, started a discussion on what PHP 8 could look like.

As I mentioned a few days ago I intended to send it slightly later - but as Nikita brought up the topic of PHP 8, this is probably as good a time as any to start the discussion. Please note: The goal of this email isn't to discuss in detail each and every topic that's mentioned, but rather to establish whether we want to move to focus on PHP 8 as we go beyond PHP 7.3, based on some of the research projects and PoCs we've been working on.

Read more [externals.io]

Breaking Laravel's firstOrCreate using race conditions original

by Freek Van der Herten – 4 minute read

Recently I was working on a client project where a data import was performed via queues. Each record was imported in its own queued job using multiple queue workers. After the data import was done we had more rows than expected in the database. In this blogpost I'd like to explain why that happened.…

Read more

The road to dependecy injection

matthiasnoback.nl

Mattias Noback shares how you can migrate a code base that fetches its dependencies using static method calls to code that uses dependency injection.

I've worked with several code bases that were littered with calls to Zend_Registry::get(), sfContext::getInstance(), etc. to fetch a dependency when needed. I'm a little afraid to mention façades here, but they also belong in this list. The point of this article is not to bash a certain framework (they are all lovely), but to show how to get rid of these "centralized dependency managers" when you need to.

Read more [matthiasnoback.nl]

A PHP debugger written in PHP

blog.krakjoe.ninja

Joe Watkins, core PHP developer and author of (amongst many other things) ptrheads, is busy creating a PHP debugger written in PHP that you can just composer require.

This isn't just pipe dreams, the PHP code exists, it's alpha quality and largely untested ...There is much to do and you shouldn't design your workflow around this (or any alpha quality software) yet. What you should do is start reading code, testing, and opening pull requests...

You'll find the code of Joe's debugger in this repo on GitHub.

Read more [blog.krakjoe.ninja]

How to hack and win the May Mayhem blog contest

alexvanderbist.com

Recently Taylor Otwell held a blogging competition. Entries could be submitted on a GitHub repo, the post with the highest amount of ? would win. My colleague Alex wrote a blogpost on how you could easily win the competition by hacking a bit. It's pretty awesome that Alex, without using any of the hacks described in the post, wound up winning the competition.

I feel like programmers are often as good at breaking things as they are at fixing things. Part of the thought process of programming anything new is figuring out its flaws, weaknesses and possible exploitations. As a web developer, I often find myself applying the same thought process to everything I see and read about online. Including Laravel's May Mayhem blog contest.

Read more [alexvanderbist.com]

Serverless Laravel

mnapoli.fr

A few weeks ago Matthieu Napoli released Bref, a tool to get any PHP project up and running in a serverless environment. Matthieu has managed to get working serverless too.

Serverless basically means “Running apps without worrying about servers”. The main difference with a traditional hosting is that you do not maintain the servers and reserve their capacity. They are scaled up or down automatically and you pay only for what you use. ... Today let’s try to deploy a Laravel application on AWS lambda using Bref.

Read more [mnapoli.fr]

The open source department at Spatie is doing overtime original

by Freek Van der Herten – 3 minute read

Bad title because we don't do overtime at Spatie, but our team has been very busy putting out new open source stuff. In the past weeks our team has released three new packages. In this post I'd like to quickly introduce them too you. sheets First up is spatie/sheets, created by Sebastian. This…

Read more

Keeping your Laravel applications DRY with single action classes

medium.com

Rémi Collin shares a cool approach on where to place code that doesn't really belong in a controller. He creates small, reusable, testable, decoratable classes, called Actions.

Using this approach can seems a lot of classes at first. And, of course the user registration is a simple example aimed to keep the reading short and clear. Real value starts to become clear once the complexity starts growing, because you know your code is in one place, and the boundaries are clearly defined.

Read more [medium.com]

How I Built The LaravelQuiz Chatbot With BotMan and Laravel

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

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]