RSSAmplifier

Blog

phpFashion

phpfashion.comRSS feed ↗20 posts

Latest posts

A replacement for PHP ext-imap that has no dependencies

As of version 8.4, the imap extension is no longer part of PHP. Anyone who read a mailbox with it needs a replacement. Except that the two most popular libraries are mere wrappers around that same extension, and the third one drags in twenty-four packages including a chunk of Laravel and Symfony. The dg/imap library speaks IMAP on its own: under nine hundred lines of solid object-oriented code and…

MySQL: Ten Rules for a Schema That Won't Betray You

I sat down and wrote up binding conventions for MySQL schema design, forcing myself to answer the question why for every single rule. That answer is half the value: a rule that can't defend itself is dogma, and the first unhappy colleague will rightly sweep it off the table. One idea runs through everything below: the database is integrity's last line of defence. The application validates for the…

Nette Mail 4.2.0: So Your Emails Actually Arrive

Sending an email is one line of code. Getting it delivered is a discipline where Gmail and Microsoft tighten the rules every year. Nette Mail 4.2.0 brings what providers demand today: OAuth sign-in, one-click unsubscribe and more modern DKIM. Plus one security patch that makes updating right away worth it. And it's a backward compatible release: you rewrite nothing, just update and pick up the new…

A form inside a form? HTML says no, Nette 3.3 says yes

Anyone who has built a non-trivial page knows a can't sit inside another . And if you have ever needed to nest one form in another, you know there was no clean way to do it for a long time. Nette Forms 3.3 finally changes that: {form detached} works around the longstanding HTML restriction with a single word in your template. Why you can't put a form inside a form Picture an e-shop checkout: a big…

Your AI Agent Is Only as Good as Your Types

The moment you start coding with an AI agent, you notice something odd: the value of a top-tier IDE like PhpStorm suddenly drops, while the value of solid type checking, say with PHPStan, shoots up. Two years ago that would've sounded like heresy. Today it's closer to practical advice on how to write better code. The IDE was for humans, analysis is for machines We loved the IDE for its…

Component Model 4.0: top-down and no more magic

Component Model is the quietest library in all of Nette. Nobody talks about it, almost nobody uses it directly, and yet it sits underneath every form and every Control in your application. Version 4.0 is largely a cleanup of deprecated API, but it also hides one genuine change in behavior. So what is Component Model actually for? If you write presenters and forms, you use Component Model every day…

A Quarter Century of CSRF. Now the Browser Finally Handles It

Cross-Site Request Forgery has been with us since at least the turn of the millennium. The principle is primitive: a foreign website sends a request to your server from the browser of an unsuspecting victim. The browser happily attaches cookies to it, so the request looks like a legitimate action by a logged-in user: a password change, a form submission, an account deletion. And for a whole…

Nette Http 3.4.0 Brings Protection Against SSRF Attacks

A user avatar. An image generated by an MCP server. An OG preview in a comment. A webhook callback. An OAuth redirect. An RSS feed import. Whenever your application fetches a URL submitted by a user (or an AI assistant), it becomes a target for Server-Side Request Forgery (SSRF), one of the OWASP Top 10 vulnerabilities. Nette/Http 3.4.0 introduces two new classes, UrlValidator and IPAddress, that…

Tracy Learned to Speak with AI Agents

Tracy learned a new dialect. When an AI agent sits on the other side, it gets structured markdown straight into the JS console alongside the usual red screen. And next to every .html exception in the log/ folder there's now a .md sibling. A human developer still sees BlueScreen, Tracy Bar and dumps in their familiar form. But when there's an AI agent in front of the monitor instead of a human, one…

Process: running external programs from PHP without the pain

Running an external program from PHP and reading what it printed? shell_exec('git pull') and you're done. But that only covers the simplest case. The moment you need more — the exit code, errors kept separate from the regular output, a user-supplied argument passed safely, a timeout — shell_exec() runs out of road. And proc_open(), which can do all of it, has an API so unwelcoming that most people…

100vw is a trap! It can't measure the viewport width

Do you also love the vw unit in CSS? The Volkswagen of units? And did you know it's complete and utter shit? The expression 100vw means one hundred percent of the viewport width. The entire browser canvas. Want your full-bleed cover to be exactly that wide? Just set width: 100vw on it. And what if the page has a vertical scrollbar? Mac users barely notice it, because macOS auto-hides it when not…

Latte as a Ghost in the Machine: a Template Compiler for Tracy

Tracy's templates have always been hand-written .phtml pages full of htmlspecialchars and nested ifs. I'll admit it bugged me for a long time. And then a heretical thought hit me: what if Latte wrote them? But Latte in Tracy? Overkill! Or rather… it could be done, just not the way you'd expect. Tracy is a debugger. It has to run in every PHP project that pulls it into composer.json. In startups,…

Duck Typing Is Dead, Dave!

There are moments when a truth in technology reveals itself so clearly that it's impossible to ignore. When the whole world independently arrives at the same conclusion. When the numbers say out loud what you've felt in your code for years. Duck typing is dead. Types have won. In all languages, in all communities, on all fronts. And I'm thrilled about it, because this path – the path of strong…

Five New Features in Latte 3.1 That Will Make Your Life Easier

Latte 3.1 brings five new features – new filters |column, |commas and |limit, improved |slice for iterators, and two new engine features. No revolution, just small things you'll appreciate. No More Variable Leaking from {foreach} This has bugged me for years. You write {foreach $items as $item}, the loop ends, and $item happily lives on with the value of the last element. Worse, it can overwrite a…

How to Make Your Code Worse by Fixing PHPStan Errors

PHPStan reports an error, you fix it. But paradoxically, that fix actually makes your code worse. How is that possible? I remember going through PHPStan output once, systematically fixing one warning after another. I felt productive. Code is cleaner, types are correct, green everywhere. A month later I was scratching my head over why a function was returning an empty string when it shouldn't. An…

What Claude Code Can Do

The other day I told Claude: “Turn off wifi.” And it did – because it knows how to do that from the command line. Then I said: “Turn on wifi.” And it did nothing. Because it had no internet. This experience nicely illustrates what Claude Code actually is. It's not just a chatbot you talk to. It's a tool that has access to your computer and can perform actions on it. It can read and edit files, run…

The Ultimate PHP Comparison Reference is Here!

No more writing test scripts when you're not entirely sure. No more tedious documentation diving. The PHP truth table has finally arrived. I've prepared the definitive PHP Comparison Cheat Sheet for you. It's your map for the territory where === doesn't rule. Since PHP 8 rewrote the comparison rules, there are two tables: 👉 Table for PHP 8.x (The present you need to master) 👉 Table for PHP 7.x…

How to Install Claude Code: A Beginner's Guide

(Updated January 2026) Claude Code is a tool that brings AI capabilities in the form of a virtual programmer. Think of it as a colleague sitting beside you, helping with your projects. Unlike regular browser-based chatting where you copy code back and forth, Claude Code works directly with your files on your computer. What You Can Do With It Here are just a few examples of what you can accomplish:…

100 minutes is less than 50? PHP paradoxes during time changes

“When shall we meet?” – “Tomorrow at three.” “When is that meeting?” – “Next month.” For everyday life, such time specifications are perfectly adequate. But try the same in programming and you'll quickly discover you've entered a labyrinth full of traps and unexpected surprises. Time in programming is like a beast that appears tame until you step on its tail. And one of this beast's most powerful…

Var, Let, Const: Stop Complicating Your Life in JavaScript

JavaScript offers three ways to declare variables: var, let, and const. Many programmers aren't entirely clear on when to use which one, and most tutorials and linters force you to use them incorrectly. Let's see how to write cleaner and more understandable code without unnecessary rules that don't actually help us. Let's Start with the Most Dangerous Part JavaScript has one treacherous quirk: by…