Segfault #1 – A new beginning!
Hello Friends 👋🏻
Welcome to the first edition of the Segfault newsletter.
I will use the opportunity to share some background about myself and the newsletter! The next issues will be a lot slimmer, promise!
🎉 A bit of Background
I fell in love with programming when I was in 9th grade (circa 1999). I vividly remember the first time I copied a piano program from a magazine, typed it in Notepad, and expected to listen to some melody when I saved it — but as you can imagine, nothing happened!
It was a sad moment for me but I knew I had to figure it out. That “figuring it out” led me to find QuickBASIC — I could then write programs using the BASIC language. I was a happy camper for a few months writing tiny programs that’d do cool things.
I outgrew that fun stage soon and wanted to write a program that would work in Windows rather than in the terminal. I then discovered Visual Basic. I was in dreamland again but this time for several years. I made lots of fun personal projects and then started doing freelance work.
A few years passed by and the web was becoming more and more important. I first looked into ASP but it was dying back then. One random day, a complete stranger whom I met for the first time in a cafe, recommended PHP when he heard I am trying to make a website. I was a bit skeptical but the moment I looked into PHP (version 4), I was hooked — I loved the simplicity and how easy it is to get something running!
Like many developers, I started writing web applications in PHP without any framework. It was fun in the beginning but writing the same boilerplate code, again and again, was tiring. It didn’t take me long to understand the benefit of frameworks and I was quick in picking up CodeIgniter. Over the years, my journey with PHP would look something like this:
No framework → CodeIgniter → Kohana → Zend Framework 1 → Zend Framework 2 → Symfony → Laravel
I worked with each of them for several years (sometimes in parallel) & learned many valuable things. IMHO each of them served the needs of their time and advanced the ecosystem forward.
🎉 What would this newsletter be about?
This newsletter is a personal distillation of what I think is actionable and interesting for someone working with web technologies, especially with PHP and Laravel.
I aim to provide you value by highlighting the contents I consume over a week and presenting the best among those in front of your eyes.
I will be covering:
Articles and Blog Posts regarding web development in general. The focus will be on the PHP ecosystem.
Tweets that are actionable, contain great resources or have a unique point of view that is worth knowing.
Tips on Laravel and its related technologies, usually very short in size but immediately actionable.
Updates from my solopreneur journey, including product updates, things I learned, books I read, experiments I’m doing, etc.
You can expect emails to arrive between 9:00 am and 12:00 pm Eastern Time every Tuesday.
🤔 But what the heck is “Segfault”?
I’m glad you asked. If you look this up in a search engine or in Wikipedia, you’ll get a generic description that applies to different programming languages. However, as we are writing web applications with PHP, here is a definition closer to our ecosystem:
“A segmentation fault, or segfault, is any condition whereby the (PHP) application has attempted to access a restricted area of memory and thus resulted in crashing the application.”
Although Segfaults occur on rare occasions, they are usually quite difficult to debug. When developing large applications with complex logic, the likelihood of it occurring increases substantially. I generally recommend familiarizing yourself with this so that you’d know how to debug it without pulling your hair out when you encounter it.
If you’re interested in digging further, here are some resources to look into:
👓 Recommended Readings
I read a few great articles over the week, so here are my top 3 picks for you.
Why I no longer use the repository pattern – author Matthew Daly explains in detail the reasons why he doesn’t use the well-debated Repository pattern in Laravel projects.
→ When I first started to work with Laravel, I was very dogmatic about using the Repository pattern. But gradually I could see that it’s unnecessary and none of the core maintainers are using this approach. So I stopped it and embraced the Active Record pattern altogether.
PHP-FPM tuning: Using ‘pm static’ for max performance – a very handy guide that illustrates how you can achieve great throughput from your PHP-FPM powered server.
→ I experimented with this in a recent project and saw great success. We were able to handle peak usage (~500 concurrent users) with no significant load on the server.
How to Build Leverage from Scratch – the amazing guide from Jack Butcher on how to use leverage to build your online presence and start earning real money.
→ I have seen Jack build his whole Visualize Value business first-hand, starting in 2020 — I bought all his courses, joined the community, and learned so much from him. He has the ability to distill valuable information in such a concise form that would amaze everybody.
If you have come across a great write-up and want me to share it with others, feel free to reply to this and/or write in a comment.
📦 Great PHP Packages
A couple of notable packages I’ve come across that I’ve bookmarked myself and would recommend to others.
FastRefreshDatabase for Laravel — this package can speed up your Laravel applications test time by 100x! It uses a neat technique of using checksum to decide whether to run
php artisan migrate:fresh.
PHP Meminfo — this is a PHP extension that gives you insights into the PHP memory content. Its main goal is to help you understand memory leaks: by looking at data present in memory, you can better understand your application behavior.
Laravel Versionable — It's a minimalist way to make your Eloquent model support version history, and it's very simple to roll back to the specified version. Very easy and straightforward configuration, and has a great API.
Here is one thread I discovered that really moved me this week:
My key takeaways from it:
Being super helpful and giving free, valuable stuff to the community is the best way to build a foundation for the future where paid products can be offered.
Marketing can be more natural if a product is built in public and the journey is shared with an audience
Contrary to the recent trend of putting up a landing page as the first step of product validation, tweets/articles/videos should be used to put ideas to the public and see how people resonate with them.
That’s all for this week. Feel free to hit that reply button if you have a question or if you would like to open a discussion.
Follow me on Twitter to get the other stuff I am sharing that won’t be included in this newsletter 😉
Thank you for subscribing.
– Mohammad Emran
PS. If you enjoyed my babbling above or found the resources I shared helpful, it would be of great help if you let your friends know about this newsletter by sharing it 🤜 🤛