A good intro intro to event sourcing
At the Devoxx UK conference Michiel Rook gave a good intro talk on Event Sourcing.
At the Devoxx UK conference Michiel Rook gave a good intro talk on Event Sourcing.
? Killing conditionals with Eloquent's "firstOr" method. If firstOrCreate, firstOrFail, or firstOrNew don't quite cut it. pic.twitter.com/PKrtqDc0vl
— Caleb Porzio (@calebporzio) 22 mei 2018
Read more [twitter.com]
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.
"Freek’s newsletter is one of the best ways to stay updated with the Laravel and PHP ecosystem. It consistently highlights useful packages, tools, and ideas from the community, especially the amazing work coming from Spatie. As a Laravel developer building SaaS and web platforms, I find it extremely helpful to discover practical tools and insights that improve my development workflow."
? Laravel Quick Tip: Did you know that you can change the keys of a collection to a given value of the collection? ? Perfect for removing items of a collection by the model id. #laravel pic.twitter.com/kgsVnkFCBe
— Christoph Rumpel (@christophrumpel) 24 mei 2018
Read more [twitter.com]
Marcel Pociot, the mind behind BotMan, has released a cool package to create visual diff in your PHPUnit tests. Under the hood it uses our Browsershot package.
I'm not sure how you feel, but I consider myself a backend developer. Sure - I know my way around Vue.JS and really enjoy working with it, but writing CSS has never been my strong point. At one of our companies recent projects, we are working together with another development team, which is mostly taking care of frontend development. So we build controllers, repositories, services, etc. and hand it over to some basic views. They handle the rest. We introduced continuous integration to them and showed them our usual workflow, when I thought that it would be excellent to also have some kind of visual CI for frontend changes.
Read more [marcelpociot.de]
My colleague Sebastian has been busy creating some low level Vue components for a client project. For these components he use JSX.
In my most recent project at work, I'm experimenting with JSX templates in Vue. Vue offers first-party support for JSX with near-zero configuration, but it doesn't seem to be commonly used in the ecosystem. I'm going to share my initial thoughts on using JSX with Vue. I'll be posting side-by-side examples of Vue templates and their JSX counterparts.
Read more [sebastiandedeyne.com]
? When linking to a file on @github, press 'y' to transform the URL to a SHA-based reference. That way, the link will remain stable even if the underlying file changes in future commits. pic.twitter.com/cAsupEk7tV
— Derrick Reimer (@derrickreimer) 30 mei 2018
Read more [twitter.com]
In most applications you store the state of the application in the database. If something needs to be changed you simply update values in a table. When using event sourcing you'll take a different approach. All changes to application state are stored as a series of events. The key benefit here is…
Recently when I was working on a project I got some strange results when using the empty function. Here's what I was debugging. I've simplified the code a bit to share with you. var_dump( $person->firstName, empty($person->firstName) ); This was the result: string(5) "Freek"…
Like he already did a few times in the past, Composer co-creator Jordi Boggiano published some interesting statistics on PHP version usage as measured by Packagist.
A few observations: PHP 7.1 is still on top but 7.2 is closing real quick with already 1/5th of users having upgraded. That's the biggest growth rate for a newly released version since I have started collecting those stats. Ubuntu 18.04 LTS ships with 7.2 so this number will likely grow even more in the coming months.
https://seld.be/notes/php-versions-stats-2018-1-edition
Matt Stauffer shares some interesting refactors suggested by his co-workers on a Vue component he wrote.
I've written some Vue since 2015, but I've also learned some React, written a lot of Laravel, run a company, and spent much of my free time writing a book about Laravel. It's time for me to get back into Vue.js and really spend some time to get good at it. Thankfully, some of the best Vue developers out there work at Tighten, so I'm putting them to work to level me up. So, I'm going to be writing new Vue code and also cleaning up some of my Vue from 2015, and I wanted to share the process with you, my lovely readers.
https://mattstauffer.com/blog/refactoring-vue-cleaning-up-a-list-of-posts-with-better-component-splitting-and-more-es6/
My colleague Sebastian started a new side project: a newsletter about programming, design, and other related topics.
Growing the Stack is a biweekly—as in, once every two weeks—newsletter about programming, design, and other related topics. The newsletter isn't tied to any programming language or ecosystem, and it's not meant keep you up to date with all the new & shiny tools out there. It tries to bundle content that inspires. Content that triggers you to consider and try out new ideas.
Subscribe here: https://sebastiandedeyne.com/newsletter
? Did you know you could use the afterCreating and lots of other "after" callbacks on Eloquent Factories to create additional models in Laravel? https://t.co/XejFph55zO #Laravel #PHP pic.twitter.com/oc8BfpEPqN
— Dries Vints (@driesvints) May 15, 2018
Read more [twitter.com]
In a new video Jason McCreary, the creator of the wonderful Laravel Shift, demonstrates a few good tips to clean up code. In the video below Jason uses a code snippet taken from my side project Oh Dear!
If you're interested in more tips from Jason be sure to check out his upcoming BaseCode field guide.
Meanwhile I've cleaned up (and deployed) the code in the actual app. This is what I ended up with:
class Check
{
public function needsToRun(): bool
{
if (!$this->belongsToTeamOnActiveSubscriptionOrOnGenericTrial()) {
return false;
}
if ($this->disabled()) {
return false;
}
if ($this->alreadyRunningOrScheduled()) {
return false;
}
if ($this->didNotRunBefore()) {
return true;
}
if ($this->checkType()->is(CheckType::UPTIME) && $this->latestRun()->failed()) {
return true;
}
if ($this->previousRunCrashed()) {
return true;
}
return $this->latestRun()->endedMoreThanMinutesAgo($this->checkType()->minutesBetweenRuns());
}
protected function checkType(): CheckType
{
return new CheckType($this->type);
}
}
use MyCLabs\Enum\Enum;
class CheckType extends Enum
{
const UPTIME = 'uptime';
const BROKEN_LINKS = 'broken_links';
const MIXED_CONTENT = 'mixed_content';
const CERTIFICATE_HEALTH = 'certificate_health';
const CERTIFICATE_TRANSPARENCY = 'certificate_transparency';
public function minutesBetweenRuns(): int
{
if ($this->getValue() === static::MIXED_CONTENT) {
return 60 * 12;
}
if ($this->getValue() === static::BROKEN_LINKS) {
return 60 * 12;
}
if ($this->getValue() === static::CERTIFICATE_HEALTH) {
return 5;
}
if ($this->getValue() === static::UPTIME) {
return 3;
}
throw new Exception("Minutes between runs not specified for type `{$this->getValue()}`");
}
public function is(string $type): bool
{
return $type === $this->getValue();
}
}
The team at Kickstarter made a simple, synchronous event sourcing library implemented in Ruby.
We’ll go over a high level introduction to Event Sourcing where we will highlight the four components that make a (minimal) Event Sourcing system: Events, Calculators, Aggregates and Reactors. We will then talk about how we implemented a (minimal) Event Sourcing Framework at Kickstarter for d.rip. And finally we’ll reflect a bit on the ah-ha moments and the challenges that we’re going through with this approach — 9 months after having started to work on d.rip and 4 months after launch.
https://kickstarter.engineering/event-sourcing-made-simple-4a2625113224
Love being able to catch multiple exception types in one catch block thanks to PHP 7.1 pic.twitter.com/YthVWxKG0A
— Jacob Bennett (@JacobBennett) May 10, 2018
Read more [twitter.com]
John Bonaccorsi, a developer from Tighten, wrote some good ways of structuring model factories in a Laravel app.
Thanks to class-based model factories, our test setup went from being a bloated mess to simple and succinct. The optional fluent methods give us flexibility and make it obvious when we are intentionally changing our world. Should you read this blog post and immediately go and update all of your model factories to be class-based instead? Of course not! But if you begin to notice your tests feeling top heavy, class-based model factories may be the tool to reach for.
https://tighten.co/blog/tidy-up-your-tests-with-class-based-model-factories
Sebastian De Deyne, package creator and JavaScript wizard at Spatie, gives some good tips on how to report an issue well.
Maintaining a number of open source projects comes with a number of issues. Reporting a good issue will result in a more engaged approach from project maintainers. Don't forget: there's a human behind every project.
https://sebastiandedeyne.com/posts/2018/a-good-issue
?? Little component I made if you want to submit data (including JSON!!) from your Vue components in native HTML forms.https://t.co/FSdiuhJLmA pic.twitter.com/pF9Gb6BYRD
— Caleb Porzio (@calebporzio) May 2, 2018
Read more [twitter.com]
My favorite Laravel feature: `higher order tap`. So simple, yet so powerful. ? pic.twitter.com/cfBU4i0zk7
— Raul (@rcubitto) May 2, 2018
Read more [twitter.com]
Barry van Veen recently fixed an interesting performance issue at our permissions package.
Recently I was investigating the performance of an application we have built at SWIS. To my surprise, one of the most excellent costly methods was part of the spatie/laravel-permission package. After reading some more it was clearly a performance issue that could be improved upon. Since the solution was already clearly outlined it was quite easy to code it and submit a pull request.
https://barryvanveen.nl/blog/46-improving-the-performance-of-spatie-laravel-permission