Daniel Rotter's Avatar

Daniel Rotter

@danielrotter.at

Studied and lectured Computer Science at fhvorarlberg, coorganizes VlbgWebDev and AgentConf, programming in #php, #symfony, #laravel, #javascript, #vuejs. Currently working at Yummy Publishing, previously valantic, Sulu and MASSIVE ART.

20
Followers
32
Following
42
Posts
04.11.2024
Joined
Posts Following

Latest posts by Daniel Rotter @danielrotter.at

<?php

/**
 * @param array<int> $values
 * @return array<int, mixed>
 */
function get_random_keys(array $values, int $limit): array {
	return $limit > 1 ? array_rand($values, $limit) : [array_rand($values)];
}

<?php /** * @param array<int> $values * @return array<int, mixed> */ function get_random_keys(array $values, int $limit): array { return $limit > 1 ? array_rand($values, $limit) : [array_rand($values)]; }

Another nice example baked into #PHP why having different return types for the same function is a really bad idea. It just results in way more effort to do things right everywhere this function is used.

27.10.2025 14:26 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
$key = $reflectionProperty->isPrivate()
	? "\0" . ltrim($class, '\\') . "\0" .$name
	: (
		$reflectionProperty->isProtected()
			? "\0*\0" . $name
			: $name
	)
;

$key = $reflectionProperty->isPrivate() ? "\0" . ltrim($class, '\\') . "\0" .$name : ( $reflectionProperty->isProtected() ? "\0*\0" . $name : $name ) ;

Would have written it something like this. Don't get why they made the parentheses mandatory though, in JavaScript I would have written it without them.

For some totally subjective reason I find switch(true) or match(true) weird πŸ™ˆ But it definitely is better than a nested ternary in a single line πŸ™‚

22.10.2025 10:47 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

When they are spread over multiple lines and indented correctly they are find IMO.

22.10.2025 09:21 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Don’t be shy, start your own meetup! You might think that starting your own meetup might be very hard. Let me tell you the story about the VlbgWebDev meetup, which might change your mind.

The other day I read a post about an organizer's experiences organizing a meetup. Since mine felt totally different, I thought it might make sense to write that down too. That's what I did in my blog post: danielrotter.at/2025/08/11/d...

#Meetup

01.09.2025 07:45 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Test creation methods on steroids with named parameters Creation methods are a well-known pattern in testing. But they are even more powerful when used with named parameters.

Object creation in tests is tedious, especially when using the constructor, which might change and force you to update many tests.

Hence I like using creation methods to decouple tests from the constructor.

✍️ I wrote a blog post for more details.

danielrotter.at/2025/06/29/t...

#Testing #PHP

07.07.2025 06:43 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

I also like them to be as short and clear as possible. I don't like it when it feels like computers have a personality, I prefer them to be very blunt.

14.05.2025 06:14 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Batch curl requests in PHP using multi handles Sending many requests in a PHP script might not be a straightforward task, especially if you want to do that in a performant manner.

Recently I had to send multiple #curl requests in a single #PHP script. Unfortunately the API was a bit confusing to me. Therefore I have written down how that worked, both for you and my future self

πŸ”— danielrotter.at/2025/04/12/b...

16.04.2025 06:46 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Automatically generate changelogs with git Generating changelogs is a rather tedious task for developers. But with a bit of discipline it becomes a one-line script.

πŸ’¬ Writing changelogs is probably not the favorite task of any developer. But instead of relying on another dependency, it's quite easy to create changelogs with command line tools.

✍️ I have written a blog post showing how I handle this.

πŸ”— danielrotter.at/2025/03/05/a...

#git #GitHub #vcs #unix

17.03.2025 07:05 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Using mastodon instead of bluesky would be a start πŸ˜‰

03.03.2025 09:47 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Yeah, totally agree with that, that's also why I would use the AWS SDK, which handles signing the request. But I was specifically talking about elastica or elasticsearch-php, I am not aware of similar functionality in these libraries.

27.02.2025 07:10 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Getting started | Elasticsearch-PHP [8.17] | Elastic

Genuine question: When do you think it would be useful? I just checked the examples on www.elastic.co/guide/en/ela..., and I don't see anything that would warrant pulling in another dependency. The code shown there is not much simpler than using any HTTP client to send those requests.

26.02.2025 10:25 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

I am also trying to avoid those SDKs as much as possible. That also includes stuff like elastica, since this is a very thin layer around the HTTP API. I don't see how these dependencies are helping, and it makes changing the actual dependency hiding behind the SDK even harder.

26.02.2025 08:38 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image Post image

General AI nit: I'm uncomfortable with it being so agreeable, complementary, and optimistic. Sometimes I want it to be like, "I dunno about that, sounds like a bad idea, but ur the boss."

19.02.2025 03:55 πŸ‘ 3 πŸ” 2 πŸ’¬ 0 πŸ“Œ 0

At least for me the problem is that many people set up something like this for every project, even if HTML+CSS (maybe with a few sprinkles of JavaScript) would have been more than good enough. And compared to that a framework is definitely complicated πŸ˜‰

17.02.2025 10:50 πŸ‘ 3 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
The problem with indirections Indirections are invaluable for programming, since basically every programming concept makes use of one. However, we should still be careful when using them.

When developing software we use all kind of indirections. Most of the time way to early, causing code to be much more complex than the required.

✍️ Since I ran into such situations, I decided to write them down in a blog post.

danielrotter.at/2025/02/05/t...

#Development #PHP #JavaScript #CSS

12.02.2025 12:49 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
Better Form Design: One Thing Per Page (Case Study) β€” Smashing Magazine Adam Silver redesigned Boots.com so that each panel became its own page, removing the need for accordions and AJAX. This inconspicuous and humble UX pattern is flexible, performant and inclusive by de...

OK, just read it again, I'm not sure if he is talking about login or registrations anymore… Still, I don't like it in either case, and lots of websites do this with login screens as well…

I wasn't sure if I wanted to share the article, but since you ask: www.smashingmagazine.com/2017/05/bett...

11.02.2025 08:20 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Just read an article claiming that users are not bothered by login screens being split into two forms (one for username and one for the password). Is it just me, or is that completely untrue? I find that pattern extremely annoying, especially when using password managers...

#UX #UI

11.02.2025 07:11 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
The 17 Ways to Run Containers on AWS There may be 50 ways to leave your lover, but there are 17 ways to run containers on AWS. I will now enumerate them.

www.lastweekinaws.com/blog/the-17-...

Love the article, don't love the fact it states.

#AmazonWebServices #Docker

04.02.2025 16:06 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
Debugging overhaul and redesign Β· Issue #5950 Β· helix-editor/helix Description The current debugging experience is less than ideal. While challenges are expected with TUI editors, the current experience is, to put it bluntly, raw. It is hard to launch or stop sess...

Oh, and something I forgot (and did not test yesterday) is that apparently the debugging experience is not that nice currently, at least that's what this issue suggests: github.com/helix-editor...

15.01.2025 09:04 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

And another thing I am a bit afraid of is that vim is installed on almost any server out there, so it would be nice not to lose the muscle memory of using vim...

15.01.2025 09:04 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
`x` on blank line selects including the following line Β· Issue #3077 Β· helix-editor/helix Summary Having the cursor on an empty line and pressing x, the newline character plus the following line is selected. Reproduction Steps I tried this: hx test.go Move cursor to a blank line Press x...

The x key for selecting entire lines works in a really strange way, since it behaves differently depending on if the line you start selecting on is empty or not: github.com/helix-editor...

15.01.2025 09:04 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

I am a big proponent of using a .editorconfig file to ensure that the most basic code formatting is the same for everyone working on the same project. However, #helix does not support that yet: github.com/helix-editor...

15.01.2025 09:04 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Biggest issue for me is when using #helix with #phpactor auto completing variables always results in two dollar signs. I am going to write an issue about this the next days, since this is obviously a bug (not sure if in #helix or #phpactor though). But there are also other things missing.

15.01.2025 09:04 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Yesterday I've tried to use #helix instead of #Neovim yesteday for half a day, and even though I like quite some aspects of it (less configuration required, integrated file pickers including support git and buffers) I gave up at some point. 🧡

15.01.2025 09:04 πŸ‘ 2 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

I mean I still see chatbots today, but most of the time it is just annoying that they are blocking some UI elements I would rather use πŸ™ˆ

10.01.2025 09:00 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

That's probably the main reason why I also never understood the hype about chatbots a few years ago. For most tasks just having a boring form is still the most efficient way to handle something.

10.01.2025 08:59 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

I've a feeling it's not working well with multiple languages… I'm a native German speaker, and configured it is as second content language, but both App and Primary Language as English. However, I still get lots of german politics in my discover feed, even though I click "Show less like this" a lot.

21.12.2024 14:18 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Is it just me, or is the "Show less like this" button in the discover #Bluesky feed not working at all? I am clicking it a lot, and I still see loads of similar messages. It's so bad that there is hardly anything I click "Show more like this" on...

16.12.2024 10:21 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

TIL that there is a `:Rex` command in Neovim, which opens the netrw explorer and positions the cursor where it was before. That's a total game changer!

#Neovim #TIL

12.12.2024 13:24 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Honestly, the bad uses of useEffect, useState, and hard to debug re-renders working in the spaces I mentioned above, gave me a large amount of fatigue around React. Just dealing with a large, moving team falling on their face with too many renders in non-obvious ways. Ugh.

So yeah, good thread.

10.12.2024 21:12 πŸ‘ 14 πŸ” 1 πŸ’¬ 1 πŸ“Œ 0