Hi everyone,
Another week has passed and it's again time to deliver the latest news and updates from the PHP community. This week we have articles on the benefits of writing clean code, tips on working with Laravel models, and the different approaches and state of generics in PHP. Tutorials this week is stacked with guides on building your first PHP package, creating a simple CRUD API using flight framework, how to find outdated composer dependencies using the 'composer outdated' command, and mastering code refactoring. Finally in our Reading section we have an article on what streams are in PHP and how to work with them, How to handle Laravel NULL like a pro and understanding singleton patterns. We have all that and more, so we do hope you enjoy this week's newsletter. If you're a student or developer on the move and want the latest PHP news and updates in one place, then subscribe to PHPWeekly.
If you have an article, tutorial or podcast that you would like to be featured in our newsletter, feel free to reach out to us at [email protected].
Do follow us on our social media channels on Twitter and Facebook.
All the best,
Adrian
|
Please help us by clicking to our sponsor:
Get Reliable, Fast & Quality Proxies, Without the Tradeoffs
Scrape or crawl any amount of data, without having to worry, settle or break the bank. Buy HTTP, SOCKS & UDP proxies you can set and forget. |
Articles
Benefits Of Writing Clean, Maintainable Code
I have been writing code now for close to 20 years, but for the vast majority of that, I never really paid much attention to how my code looked, how maintainable it was long term, I was only really interested in if it worked and did what it was supposed to, but it was full of bad practices and I had a lot of bad habits.
Laravel Model Tips
In this article, I'm going to cover some of my favourite tips for working with Laravel models. Hopefully, these tips will help you write cleaner, more efficient code and help you avoid common pitfalls.
Extend or implement
I'm probably part of a small group that actually cares about this: the difference between extending an abstract class and implementing an interface (ideally with a trait to provide part of the default implementation).
When everything fails, you can always trust the Laravel rescue helper
Your application probably has a number of minor and more significant bugs. Some bugs will destroy your application, making it impossible to use, while others can be ignored. The problem? When something goes wrong, we love to throw an exception; it is so easy.
State of Generics and Collections
Generics have been on the list of wanted features for a long time by numerous PHP developers. The topic is often brought up in "What's New in PHP?" talks as well during Q&A. In this article we will be exploring the different approaches, and what their current state is.
PHP Attributes: how to use PHP Attributes and create custom attribute classes – Fast Tips
Attributes are a powerful feature that allows you to add metadata to declarations like classes, methods, or properties. These metadata can be retrieved programmatically, opening up new possibilities for cleaner, more organized, and efficient code.
|
Jobs
Web Scraping Specialists Wanted
If you're a skilled Web Scraping Specialist with a knack for creative problem-solving, join our remote team to gather data from e-commerce websites and enhance our data-driven solutions. Embrace challenging projects, overcome blocking technologies, and collaborate with a diverse global team in a flexible, fast-paced environment.
Junior PHP/Python Developer - Remote
We're looking for Full-Stack Developers to join our dynamic remote international team. As a developer, you'll work on a range of projects, including Business Intelligence systems, Legal SaaS, and cutting-edge online projects. You'll be responsible for improving legacy systems, monitoring technical systems, and delivering high-quality solutions. You should be proficient in front-end and back-end development, have strong problem-solving skills, and experience with Python, PHP, Postgres, MongoDB, and Linux servers. If you're a self-motivated team player, apply now.
Technical Support Manager - Remote
Are you interested in programming but don't have the experience yet to be a skilled developer? Join our team as a Technical Support Manager and be part of our SaaS company's success. You'll work closely with our customers to provide timely solutions, troubleshoot technical issues, and contribute to feature development. Using your skills, you'll quickly identify and resolve issues, while also working closely with our team to deliver an exceptional customer experience. You don't need to have programming experience to succeed in this role, but you should have a passion for technology and a desire to learn. You will help us enhance our products and deliver an outstanding customer experience.
|
Tutorials and Talks
How to Build Your First PHP Package
If you want to create a PHP package from scratch and share it with other PHP developers, Composer is a dependency manager that makes the process easy! Thanks to Composer, PHP has one of the top package ecosystems. Let's dive in together and walk through the steps to create a PHP package.
How To Build And Distribute Desktop Apps Using PHP And PHPDesktop: A Step-by-Step Guide
In this guide, i will walk you through the process of creating executable desktop applications using PHPDesktop - a tool that allows developers to package their PHP web applications into standalone desktop executables.
A Beginner’s Guide to Constructor Property Promotion in PHP
This blog will walk you through what it is, why it's useful, and how you can use it with plenty of coding examples. Let’s get started!
Build a Simple CRUD API in PHP with the Flight Framework
Today, I'm excited to share a project I've been working on: a Simple CRUD API built using the Flight framework. This project serves as a boilerplate for anyone looking to quickly get started with building a CRUD application in PHP.
Find Outdated Composer Dependencies Using "composer outdated"
In this Quickfire article, we're going to take a quick look at the composer outdated command to help you find outdated packages in your PHP project.
Mastering Code Refactoring: A Complete Guide to Using Rector PHP
If you’ve been wondering how to use Rector PHP, how to install it, or what exactly Rector PHP is, this comprehensive guide is for you.
Creating Multi-Language Laravel 11 Database & API
In this blog post, I will explain step by step all you need to create a localized API using Laravel. I will assume you already created a new Laravel project, so let’s start directly with database structure.
Avoiding Hard-coded Indices in PHP and Laravel
Ever had that sinking feeling when your code suddenly crashes in production, all because you tried to access an array element that doesn’t exist? Or worse, your app starts throwing errors left and right, and you have no idea why?
How to use PHP-VCR to record and replay API calls in PHP
In this post, I am going to tell you about a library that I think you’ll find pretty amazing. The best part is that it will save you time and money. |
News and Announcements
Asset Prefetching Strategies with Vite in Laravel 11.21
The Laravel team released v11.21 this week, which includes asset prefetching strategies for Vite, a convenience method to force-destroy models with soft deletes, testing helper updates, and more.
Lightweight Spreadsheets for Laravel
If you're looking for a lightweight package that can read and write spreadsheets, Chris Morrell's Linen package is a lightweight spreadsheet package for Laravel.
A Week of Symfony #921 (19-25 August 2024)
This week, the upcoming Symfony 7.2 version added a feature to render a Twig block with the Template attribute, improved the Serializer with a snake case to camel case name converter, and added support for new operators in the ExpressionLanguage component. In addition, we published new talks for the SymfonyCon Vienna 2024 conference, including sessions on containerization with DDEV and best practices for Symfony.
Symfony 7.1 curated new features
We blogged about the great 7.1 new features. I highly recommend you to read these articles about Symfony 7.1 as they contain the major changes for this new version.
SymfonyCon Vienna 2024: GraphQL, REST or RPC? Making the choice!
SymfonyCon Vienna 2024, our next annual international Symfony conference, will take place on: December 3 & 4: Two days of hands-on workshops to learn, practice, and enhance your skills in small groups. December 5 & 6: Three English-speaking tracks with over 35 outstanding speakers, an Unconference track, and a lively community evening.
|
Podcasts and Vlogs
PHP Ugly: 394: ELIE, Explain It Like I'm Eric
This week on the podcast, Eric and John talk about To Double or Single Quote Your Code, Fake Reviews, PHPTek CFPs Open, Making Mastondon More Fun, Gernerics In PHP, and more...
The Stack Overflow: From PHP to JavaScript to Kubernetes: how one backend engineer evolved over time
On today’s episode, we chat with a listener, Geshan Manandhar, who has been working in the world of software engineering for two decades. He started programming in Kathmandu during the days of dial-up. Since then he’s worked across three continents and today is a senior software engineer at Simply Wall Street. He gives his advice on how developers can change with the times and what it’s like to move into the era of serverless containers.
North Meets South Podcast: Remote pairing around rounding errors with a pint
In this episode, Jake and Michael discuss (inadvertently) bathing keyboards, pairing with remote colleagues and friends, using rational numbers to deal with rounding errors (sort of), and running code style fixers in CI or as a pre-commit hook.
Maintainable Podcast: Cassidy Williams: Navigating the Career Jungle Gym in Tech
In this episode of the Maintainable Software Podcast, Robby sits down with Cassidy Williams, Developer Advocate at GitHub, to explore the dynamic nature of a tech career, the delicate balance between clever code and maintainability, and the evolving trends in software development.
Software Engineering Radio: SE Radio 630: Luis Rodríguez on the SSH Backdoor Attack
Luis Rodríguez, CTO of Xygeni.io, joins host Robert Blumen for a discussion of the recently thwarted attempt to insert a backdoor in the SSH (Secure Shell) daemon. OpenSSH is a popular implementation of the protocol used in major Linux distributions for authentication over a network.
Developer Tea: Limiting Factors - The Hidden Focus That Matters the Most
In today's episode we discuss focus, again. This time, through the lens of a few mental models that help us decide what is actually the right thing to focus on. You'll learn the real enemy of focus (note: it's not just distraction).
Shoptalk Show: Frostapalooza Recap, Follow Up, and Messy Codebases
Chris has a birthday today, we recap our Frostapalooza experience celebrating Brad Frost's birthday, do all codebases become a mess, Mermaid, TLDraw, and Figjam thoughts, making tiny games, where's the follow up in web and world news, and what's the current state of CMS' on the web?
WP Builds: 386 – What just happened? A new show with Rae Morey from The Repository. Episode 1.
So this is really, truly, genuinely exciting for me! Today, we announce a new show “What just happened?” with Rae Morey. Rae, a former newspaper journalist turned web developer, curates top WordPress stories over at The Repository.
Over Engineered: The Art of Pairing with Strangers w/ Ben Holmen
Ben Holmen started his Pair-amid scheme as an experiment in meeting new people and experiencing new code. He shared his calendar with the world, and booked pairing sessions with 15 complete strangers. The outcome? A bunch of new friends and new experiences.
Syntax: CSS: Scroll Driven Animations
Introduction to capabilities of scroll driven animations to create interactive effects based on scroll position by scrubbing existing CSS animations and keyframes over a scroll timeline instead of time.
The Changelog: What good programmers worry about
Waymo cars make bad neighbors, Leonardo Creed pulls together wisdom from Linus Torvalds & the Art of Unix Programming to conclude what good programmers worry about, Max Schmitt makes the argument that toast notifications create a bad user experience.
|
LCS #5 - Patricio: Mingle JS, PHP WASM, VoxPop
PatricioOnCode joins us to talk about Mingle JS which allows you to mix React and Vue components in Livewire.
Streams in PHP: What you really need to know
In this article I'll try to explain what streams really are and how to work with them. We will see many functions used to work with streams as well as lots of examples, but it is not my intention to "redocument" all of them in any way.
Understanding the Singleton Pattern with PHP Example
The singleton pattern is a design pattern that restricts the instantiation of a class to a single instance. This is particularly useful when exactly one object is needed to coordinate actions across the system.
Building Real-Time Applications with Laravel Broadcasting
Whether you’re building a chat application, live notifications, or real-time data updates, broadcasting can help you achieve seamless, live interactions. Let’s explore how to leverage this feature in your Laravel projects.
Custom Resolver For MapRequestPayload to handle Patch Request in Symfony
Today we’re going to talk about Symfony, especially attributes in Symfony and the new features MapRequestPayload and MapQueryParameter. These tools have made handling HTTP requests in our applications much more straightforward.
NULL Nightmare? Not Anymore! Laravel Tips to Handle NULL Like a Pro
This article will guide you through the pitfalls and provide expert tips to handle NULL like a pro in your Laravel applications.
Php and Postgres team up to optimize multi-inserts
In some scenarios you need to insert more than one row in a table. Maybe in more than one table. Typical techniques require sending a single database query for each of them, but a Postgres feature will let you use your Php models to do many inserts at the same time.
|
Interesting Projects, Tools and Libraries
mehr-als-nix/assumptions
Assumptions can be used to skip tests when common preconditions, like the PHP Version or installed extensions, are not met.
glady/phplot
PHPlot - Create charts in PHP - forked from davefx/phplot.
starise/deep-links
Utility to add anchor links and IDs to all headings in content.
sol-hiqdev/bare-yii2
Dependencies free version of Yii 2.
haruncpi/laravel-option-framework
Manage your laravel application's dynamic settings in one place with various supported input types.
mralaminahamed/forminator-stubs
Forminator function and class declaration stubs for static analysis.
friendsofsulu/maker-bundle
Package to generate configuration and boilerplate code in Sulu.
phptailors/phpunit-methods
Assertions on object methods for PHPUnit-based tests.
axeldolislager/coinmarketcapapi
CoinMarketCap API package for Laravel.
karls/apicore
This is basic for all external APIs.
|
Please help us by clicking to our sponsor:
Protect your PHP Code
Why not try SourceGuardian 15. Click here to download a 14 Day Trial copy. Protect your code using Windows, Linux or Mac and run everywhere with our free Loaders. |
So, how did you like this issue?
|
|
|
|