Posts tagged with php
Exploring Event Sourcing (part 2) original
In this stream my colleague Brent and I continued our conversation about the foundations of event sourcing. This time we showed a shopping cart that we've built using Laravel and event sourcing.
If you're interested in learning more about event sourcing, be sure to check out our upcoming course on using event sourcing in Laravel.
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.
"If you are one of the *millions* who have downloaded a Spatie package, then you understand the quality that Freek aims for. The newsletter is of the same quality of any Spatie package you're using."
A lightweight solution for running PHP code concurrently original
Our team released a new package called spatie/fork. Using this package you can easily execute multiple pieces of code concurrently.
Function Inlining in PHP's Zend Engine
PHP has several over 30 functions at the moment that make use of special OPCodes or otherwise inlined to improve performance.
Read more [php.watch]
Injecting extra data in the payload of queued jobs in Laravel original
I'm proud to announce yet another package by our team: spatie/laravel-interacts-with-payload. This one, which was inspired by a blog post by James Brooks, can inject data in all your jobs with just one line of code.
In this video, you'll see the package in action, I explain the internals and the tests. If you prefer reading, continue below the video.
Controlling the flow of time in your tests original
Our test-time package makes writing tests, for code that makes its decisions based on the current time, very easy.
Here's how we use the package for some tests in Mailcoach.
Exploring event sourcing
My colleague Brent and I are currently preparing a premium course on event sourcing in Laravel. In this stream, we explained the foundations, shared some thoughs on some of the concept, and answered questions from the audience.
A lightweight Laravel package to track changes over time original
I'm proud to announce that our team has released a new package called spatie/laravel-stats. This package is a lightweight solution for summarizing changes in your database over time.
Injecting Additional Data into Laravel Queued Jobs
The Queue class contains a method named createPayloadUsing which allows you to register a callback that is executed when creating job payloads.
Read more [james.brooks.page]
Starting with Event sourcing
Event sourcing is about storing changes, instead of their result. It's those changes that make up the final state of a project.
Read more [stitcher.io]
Better Laravel / PHP Code: five guidelines from Spatie
YouTube star Povilas Korop shares and discusses five rules from our guidelines.
Data Transfer Object v3 has been released original
We've released a new major version of spatie/data-transfer-object. This package makes it easy to create objects that have a certain shape. Properties can even be validated.
🐘 Need self-validating PHP objects? Here you go!https://t.co/osPCSr0qu8
— Freek Van der Herten 🎆 (@freekmurze) April 2, 2021
Gotta love PHP 8
Very nice work by @brendt_gd pic.twitter.com/Sn1mS7R8Sv
In this post I'd like to tell you more the package.
Handling console signals in Laravel original
When you cancel a long-running artisan command with Ctrl+C, a SIGINT signal is sent by the operating system to the PHP process. You can use this signal to perform some cleanup quickly.
Symfony 5.2 introduced support for handling signals in commands.
We've released a package called spatie/laravel-signal-aware-commands that provides a substantial improvement to how you can use these signals in a Laravel app. In this blog post, I'd like to tell you all about it.
Creating a Laravel package from scratch original
In this stream, you'll see me lay the foundations for the spatie/laravel-signal-aware-command package.
Improving Ignition's security
A few days ago, you might have received a Dependabot security warning on Ignition concerning a remote code execution vulnarablity. This post on the Flare blog explains why most people shouldn't be effected by this.
Read more [flareapp.io]
How to Unit Test a Laravel API with the Pest Framework
– www.twilio.com - submitted by Nuno Maduro
In this tutorial, we’ll be looking at how to get started using Pest in a Laravel project. Using the test-driven approach, we’ll be building a simple to-do application that allows you to create, edit, update and delete tasks.
Read more [www.twilio.com]
Why and how you should remove inactive users and teams original
There are many SaaS applications that allow potential new customers to try out the service using a trial period. Of course, not everybody will convert. After the trial period is over, some people will not use the service anymore. However, if nothing is being done about it, their email address and…
Nodes and the Visitor pattern
– lorisleiva.com - submitted by Loris
Learn why, when and how to structure your data as a cluster of nodes and how to execute various operations on that cluster via external visitors.
Read more [lorisleiva.com]
Composer Security Hardening
– php.watch - submitted by Ayesh
Security precautions Composer already has, and what you can do to improve them further.
Read more [php.watch]
Using a HasOne over a HasMany relationship in Laravel
When you are working with a one-to-many relationship, it is sometimes the case that a particular instance on the "many" side of the relationship is flagged as unique and important to your system in some way. It can be really handy to be able to access that unique instance in a first class way from your models. This post is going to cover how you can do that without introducing any new concepts into your application.
Read more [timacdonald.me]