If you’re programming user management in WordPress there are a number of functions we have the convenience of using on the front-end. If you want to use the same functions in the back-end, though, you’ll need to include some “dependencies.”
Continue readingCategory: Articles (Page 18 of 258)
Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.
TL;DR: To dynamically load classes by namespaces in PHP, you need a Registry, and a way to parse the concrete files from a directory based on its namespace.
Whenever I’m working on a project that has an object-oriented code base and that uses Subscribers and Services, I often use a Registry. This makes it easy to
- register the subscribers with the core application whenever the code runs,
- de-couple any
Serviceclasses so they can be tested or even run isolation, - and maintain the code base whenever something has to be added or taken away.
One challenge with this approach though, at least in PHP, is that I’ve found myself having to go back into the Registry and set a reference to a given Subscriber whenever I want to add it (or remove it whenever I want to, you know, remove it).
Ideally, I want my registry to know where the subscribers are and how to set them up. This way, I can focus on working on the rest of the code.
Continue readingTL;DR: Ray makes it easy to start measuring performance of your code both in WordPress and in standalone PHP solutions.
I don’t know if this is something that’s common within WordPress development, but if you’re working on functionality that deals with a lot of files, a batch of operations, or both, then this is something that may be useful.
⚠️ If you’ve not already set up your environment, please read this post and make sure you have the free version of Ray installed.
Continue readingTL;DR: If you’ve read previous posts this month, you new I’ve been applying Cal Newport’s digital detox (covered here and here). For those just looking for the short version, here it is: I don’t have a desire to add much back to my phone and no I don’t feel like I’m missing out on anything.
In the last post, I gave a pretty long list of how things were feeling about halfway through the experience. In this post, I may recap some of it but the rest of all of this is going to be new.
I’d rather share things that have happened since then, or since the beginning, than rehash anything I’ve already written. So if you’re looking to catch-up, here are the posts:
And now, for the rest of it.
Continue readingTL;DR: Though knowing how to use a debugger is useful, it can be overkill for some of the work that we’re doing. In this article, we’ll look and see what debugging functionality Ray provides and how we can use it when traditional debugging may be overkill.
⚠️ If you’ve not already set up your environment, please read this post and make sure you have the free version of Ray installed.
Continue reading