Recent Posts
The Definitive Guide: How to Set Up Mullvad Correctly
Introduction: VPN is not anonymity
It’s common to think that a VPN solves the privacy problem on its own. I used to have that impression too: turn on the VPN, done — nobody can see anything.
In practice, it’s not quite like that.
A VPN hides your IP address and prevents your ISP from directly seeing which sites you visit. It’s also useful on public Wi-Fi networks. But that doesn’t mean you’ve become anonymous.
Reflections on AI
Lately I’ve been thinking about AI. These days, everywhere you go, you’ll always find something like: “Use this prompt to generate that,” “upload your résumé for this,” “give access to the newest agent that will automate everything.” It can send emails for you, manage your life, automate your job search for you. All of this brings an enormous amount of convenience to our daily lives and helps us optimize our time. I personally use AI for everything: studying programming, at work, learning languages, and so on.
Software Architecture & Development Consulting
Is your system growing and the architecture starting to become a problem?
I can help you analyze your project, identify technical issues, and define simpler, scalable, and sustainable solutions.
How I can help
🏗️ Software Architecture
Analysis and evolution of the architecture of systems, APIs, and backend applications.
- Application architecture
- APIs and integrations
- Distributed systems
- Scalability
- Performance
- Software engineering best practices
🐘 PHP & Laravel
Consulting for projects using PHP and Laravel.
Create a local git server
Hello everyone!
Today I’d like to share a quick and useful tip: how to create a local Git server. Imagine this situation: you and your colleague are working on an important feature in the office and you need to deliver it in just a few days. Suddenly, the internet goes down — and your mobile data isn’t working either. You urgently need to send the part you just developed to your colleague. Feeling that cold panic already?
Building a RAG with Laravel
Lately I’ve been studying AI: how to write more efficient prompts, how to build a RAG, and how to fine-tune an AI model. And, in order to solidify my knowledge, I decided to build a project with Laravel where I can practice in a more concrete way. Especially because nowadays, all anyone talks about is AI, but I don’t see much content in Portuguese about how to build a RAG with PHP.
I Migrated from WordPress to Hugo
Well, I think you noticed the blog had a layout change. I’ll explain why I made this radical change to my blog, but first I’ll tell the story from the beginning.
Why I decided to start a blog
In 2019, I was, let’s say, in a plateau: I couldn’t finish any project I started.
That’s when the idea of starting a blog came to me — something I could finish quickly, so I wouldn’t get discouraged during the creation process.
About
I’m Diego França, a Software Architect and Senior Full Stack Developer behind the blog diegofranca.dev.
I’ve been working in software development for over a decade, with experience mainly in PHP, Laravel, MySQL, and system architecture. Throughout this time I’ve worked on projects of different sizes and contexts — from small products to large systems with high traffic and complex integrations.
My focus is on writing about PHP, different kinds of testing, building pipelines, and occasionally sharing summaries of tech books.
Decorator Design Pattern
A few days ago, I was working on a system responsible for syncing data between two systems. The new task required reusing that same system to sync with a third one, but with a few extras: I wanted to send a notification at the start, another at the end, add logs, and accept more parameters.
The problem? That method was already being used in several places in the system. Changing it directly would make the code fragile and pose a high risk of breaking other parts.
How to create and publish your own PHP package on Packagist
Hello everyone! Today I want to share with you how to create and publish PHP packages on Packagist. Have you ever written reusable PHP code and wanted to install it in another project without duplicating it — and even share it with the PHP community?
So today I’ll create a simple package and show you how to publish it on Packagist. The package I’ll create will be something very simple — a package that adds two numbers and returns the sum.
Stop using env() inside your Laravel application (outside of config/)
I want to share a quick tip about Laravel. I see many people running into trouble when trying to access environment variables inside the application. The most common mistake happens when developers use the
env()function directly inside their classes or services to read settings from the.envfile, and then can’t figure out why, in some situations, that function returnsnull.The explanation is simple: it happens because of Laravel’s initialization flow. To help visualize it, I created a diagram that explains how this process works:
Installing Apache Kafka
Hey folks! Today I’d like to share a bit about Apache Kafka. I’ve been working with Kafka to sync data across multiple databases and thought it would be interesting to share some of what I’ve been learning. Also, this article will be a place I can easily come back to whenever I have a question in the future.
What is Apache Kafka
Apache Kafka is an open-source platform for streaming data in a continuous flow. It’s a high-performance, real-time messaging system. In recent years, Apache Kafka has become very popular due to the growing adoption of microservices.
Creating a local Git server
Hello everyone!
Today I’d like to share a quick and useful tip: how to create a local Git server. Imagine this situation: you and your colleague are working on an important feature in the office and you need to deliver it in just a few days. Suddenly, the internet goes down — and your mobile data isn’t working either. You urgently need to send the part you just developed to your colleague. Feeling that cold panic already?
How to install multiple PHP versions on Ubuntu
Hey folks! Once again with another super quick and practical tutorial on how to set up multiple PHP versions on Ubuntu. Hope you enjoy.
Sometimes, when we’re developing our applications or working on other projects, we may run into different PHP versions than what’s installed on our machine. Then we spend hours and hours on the internet looking for a solution that actually works.
This tutorial was tested on my personal machine with the following configurations:
Installing an SSL certificate on Apache
Hey folks!! Today I’ll show you how to create self-signed Apache certificates. This is very important when we’re setting up our web systems and want to add an SSL certificate to our web server. In this tutorial, I’m using Ubuntu 22.04.
Creating the certificate
In the first step, we’ll create our certificate. Open your terminal and run the following command:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/apache-selfsigned.key -out /etc/ssl/apache-selfsigned.crtAfter running the command above, some information will be displayed for you to fill in:
Demystifying Unit Tests
The idea for this post came up after I gave a presentation on unit tests at the company I work for. During the presentation, I did a live code in which I created an endpoint using the concepts I’ll cover here, in order to isolate the component. I would love to build an application right here on the blog, but doing a step-by-step might get a bit tedious. So I decided to summarize what was presented, with code examples for better understanding.
Richardson Maturity Model - Measuring the maturity of your API
Hey folks! Today I have something interesting about RESTful APIs. When you’re building a RESTful API, have you ever stopped to think if what we’re developing is correct and if there’s a standard to follow when creating one?
There is indeed a way to know if what we’re developing is a RESTful API and how mature it is — it’s called the Richardson Maturity Model. The first time I heard this term was on Michelli Brito’s channel — I recommend following her channel. I was motivated to write a bit of my understanding on the subject, but before I begin, let me give an overview of the difference between REST and RESTful, since many devs still confuse the two terms. Without further ado, let’s go.
Building a scalable application — Part 1
Hey folks! Today I want to start my journey learning how to build scalable applications. I’ve always been curious about how these big companies handle thousands of simultaneous accesses while keeping their services online, and what it would be like to work with scalability in applications. Thinking about that, I created a URL shortener and my goal is to learn more about scalability and to run load tests on applications.
Building a scalable application — Part 2
Hey folks! How’s it going? Continuing our journey of building a scalable application, in this second part I’ll tell you how the beginning of the tests went, if you haven’t read the first part, click here.
At first I tried to run the load-testing tool K6 against the application running on my personal machine. I started with 1000 users hitting it simultaneously and got only 2% success. When I tried with 2000 users, I started getting a “socket: too many open files” error. For comparison purposes in this test I’ll stick with 1000 both on my machine and on the Heroku server. I created an account on Heroku, whose configurations aren’t very robust, but as the tests progress I might switch plans to do a better test.
Best Practices with PHP (PSR) — Part 1
Hey folks, how are you doing? Today I’m bringing you something new for those of you who program in PHP: I’ll start a series where I’ll show you the best practices in PHP development according to the PSRs. Without further ado, let’s begin.
What is a PSR?
PSR (PHP Standards Recommendation) is the recommendation manual for PHP. The site that defines these recommendations is PHP-FIG, where we find all the PSRs we’ll use throughout this series.
TDD - Analyzing Feedback
Lately I’ve been studying TDD in depth and how it can help us write good code.
Many developers still haven’t adopted this practice — some because they lack knowledge, others because they think they lose productivity when writing tests before development.
In this article I’ll base myself on the book written by Mauricio Aniche, Test-Driven Development: Testing and Design in the Real World with PHP, where he exemplifies some of the feedbacks that the practice of TDD can give us to help write good code.
Clean Code - Magic Numbers
Sometimes we think that to refactor a code and make it more readable we need to do something complex, but that’s not always the case — sometimes just renaming a variable to a name that matches what it really does is already a big step.
Last weekend, I was studying TDD and decided to write a simple login code. In that algorithm there were some HTTP response status codes — 400, 401, 403, 422, and so on — that I had added directly into the code. Then I thought: “Would someone who doesn’t know HTTP status codes know what this means?”
CentOS is dead — what now?
Hey folks!! In the past few days we were surprised by the news that Red Hat will no longer support CentOS — but what does that mean?
It means that CentOS Linux 8, which is a rebuild of Red Hat Enterprise Linux 8 (RHEL), will reach end of support in 2021.
Once CentOS 8 support ends, you’ll need to migrate to CentOS Stream, which will receive updates the way CentOS used to and will serve as the upstream (development) branch for RHEL.
PHP 8 is released
The PHP development team announced the release of PHP 8 on November 26, 2020:
PHP 8.0 is a major update of the PHP language.
It contains many new features and optimizations including named arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and improvements in the type system, error handling, and consistency.
Here’s a list of some of the new PHP features:
- Union Types
- Named Arguments
- Match Expressions
- Attributes
- Constructor Property Promotion
- Nullsafe Operator
- Weak Maps
- Just In Time Compilation
- and much more…
Here are some highlights of the release:
Basic Git Commands
Hey folks, how’s it going? I’m here to help those who started using Git and still struggle with the commands. In this tutorial I’ll demonstrate some commands that will make your learning journey much easier.
UNDERSTANDING THE GIT WORKFLOW
Git is the most widely used open-source VCS (Version Control System) in the world, and it lets you track changes in your files. Companies and developers around the world use Git to collaborate on building systems and applications.
GIT - Conventional Commits
Hey folks, how’s it going? Today I’m sharing a tip on how to standardize commit messages in our projects. Sometimes when there’s more than one developer on the project and the rush of day-to-day life, the messages end up not being that great. It’s very common to see the famous “AD” (various changes) or “VA” (multiple changes), which makes our dev life — which is already not easy — much harder :D.