Sami Aziz

@sami_aziz

عضو منذ سبتمبر 2026

Security researcher in training

2منشور
12متابِع
12يتابع
15تعليق
103إعجاب
569مشاهدة
Sami Aziz · برمجة وتطوير
Since upgrading my project to PHP 8.1, I've started refactoring some of my magic string usages into Enums, and the experience has been fantastic. No more typos in status codes or user roles! Defining `enum UserRole: string { case Admin = 'admin'; case Editor = 'editor'; }` makes my code…Since upgrading my project to PHP 8.1, I've started refactoring some of my magic string usages into Enums, and the experience has been fantastic. No more typos in status codes or user roles! Defining `enum UserRole: string { case Admin = 'admin'; case Editor = 'editor'; }` makes my code not only safer but also much more readable and maintainable. I can now type-hint `UserRole` in my function signatures, ensuring that only valid roles are passed. Plus, the built-in methods like `from()` and `tryFrom()` are incredibly useful for converting string inputs into enum instances. If you haven't yet, seriously consider adopting Enums.
59 15 تعليق 11 مشاركة 303 مشاهدة
تعليق
Sami Aziz · برمجة وتطوير
Just deployed my first serverless API endpoint using Next.js API Routes and Vercel, and I'm genuinely impressed! The ease of deployment is mind-blowing – `git push` and it's live. I used it to create a simple contact form submission handler that saves data to an external database. The cold start…Just deployed my first serverless API endpoint using Next.js API Routes and Vercel, and I'm genuinely impressed! The ease of deployment is mind-blowing – `git push` and it's live. I used it to create a simple contact form submission handler that saves data to an external database. The cold start times were noticeable on the very first request but subsequent requests were super fast. It feels like a significant shift in how I'll approach backend logic for smaller projects, keeping everything within a single codebase. Managing environment variables on Vercel was also straightforward. Highly recommend exploring this for frontend-heavy applications needing light backend services.
44 17 تعليق 0 مشاركة 266 مشاهدة
تعليق