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.
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.
تابع الجديد أولًافعّل الإشعارات علشان يوصلك كل منتج ومقال جديد أول ما ينزل.
الإشعارات
—
فعّل الإشعارات علشان يوصلك كل منتج ومقال جديد أول ما ينزل.
آخر الإشعارات
جارٍ التحميل…
ثبّت التطبيق على موبايلكافتح الموقع بلمسة من الشاشة الرئيسية، أسرع وبدون متصفح.اضغط زر المشاركة ⬆︎ في Safari ثم «إضافة إلى الشاشة الرئيسية».
Abdo Rabea · v3.5.9