OpenLampTech No. 139
PHP Attributes | WooCommerce cart page hooks guide (Block version) | Relationships in Laravel | MySQL tuning for WordPress | PHP sessions | AI-driven developer
Thank you for reading the OpenLampTech newsletter!
If someone awesome shared this newsletter with you and you are not yet subscribed, please use the Subscribe button below and join:
OpenLampTech has sponsorship opportunities for your brand, product, or service in the weekly newsletter. As an independent publication, collaboration is very affordable.
Ash Allen has an in-depth guide on PHP Attributes here that is fantastic.
There are easy-to-understand explanations with code samples to quickly bring you up to speed on the important concepts of Attributes.
Learn more about Ash Allen in this OpenLampTech developer interview.
Also, don't miss either of his well-received and successful books, Battle Ready Laravel and Consuming APIs In Laravel. (affiliate)
[Ash Allen Design]
Adding REST API Support For Custom Content Types
This official documentation has examples of how to enable REST API functionality for WordPress Custom Content Types. As shown in the content, simply set show_in_rest => true in the array argument that is passed to register_post_type(). Doing so will also add a route in the namespace for wp/v2.
[WordPress Developer Resources]
Understanding Relationships in Laravel
An ORM - Eloquent in Laravel's case - allows you to work with databases in an object-oriented style.
Relationships are the means to interact with data from different models.
Many are similar (if not the exact concepts) to those found in relational database terminology such as:
One-to-one
One-to-many
Many-to-one
[Medium]
How MySQL Tuning Can Dramatically Improve WordPress Performance
Roman Agabekov of Releem has a great article here on performance tuning the WordPress MySQL database.
Database performance is sometimes overlooked by devs who mostly concentrate on optimized application code, which is also vital.
However, tools like Releem can simplify tuning the WordPress (and WooCommerce) database.
[dev.to]
[Affiliate]
Consuming APIs in Laravel - Learn how to confidently integrate third-party APIs in your Laravel projects using maintainable, testable, and extensible code.
Session and User Registration in PHP
Websites can store user interaction data in a session. PHP has built-in functions, such as session_start(), for creating and managing sessions.
This article has an example of how to register a user using the $_POST array and work with session data in the $_SESSION superglobal array.
[dev.to]
The AI-Driven Developer: From Assistance to Autonomy in Drupal Development
While I've had both good and bad results using AI (ChatGPT and Gemini), I'm nowhere near ready for an AI agent.
I think you somewhat need to know and understand just what you're getting back from AI to use it effectively. Something I am learning (albeit the hard way) as I explore using AI more.
[The Drop Times]
WooCommerce Visual Hook Guide: Cart Page (Block Version)
Here is another fantastic WooCommerce resource from the Business Bloomer website.
Since WooCommerce Cart and Checkout pages use blocks by default, their hooks and ability to modify the pages with PHP (snippets) drastically changed.
You will find a crafty workaround in this article. Based on my understanding (of the code), you can essentially piggyback off of hooks and output your custom content.
[Business Bloomer]
Laravel MySQL Spatial extension
I wanted to share this article in OpenLampTech in case any readers may be working with spatial data using Laravel. This Laravel extension/package also supports MariaDB. In this package, MySQL v8.x and Laravel 8+ versions do support spatial SRID which is very helpful.
How to Build a MySQL Admin Panel (Fast & Easy)
While I've not used Five personally, the platform appears to be quick and easy to get started with.
From what I can tell, Five takes care of a lot of the infrastructure/setup/deployment for apps. Removing or abstracting away that barrier is always a plus in my opinion.
And, a lot of Five’s content is focused on MySQL. Also a good thing.
[five.co]
WooCommerce news and updates
WooCommerce 9.1: Coming soon, product lookup optimizations, and checkout styling galore (July 11th, 2024)
Developer Advisory: Checkout Block Accessibility Issue in 9.1 (July 11th, 2024)
WooCommerce 9.1.1: Dot Release (July 11th, 2024)
[#Affiliates and Classifieds] - Your support keeps the OpenLampTech newsletter free for readers
Ultimate Laravel Boilerplate to help other indie hackers deliver their SaaS in hours. Get started with LaraFast today! (affiliate)
Popups, newsletters, and abandoned carts. Use Omnisend with integrated email and SMS campaigns. (affiliate)
Thank you for reading. I hope you have a great rest of your week.
Take care.
Josh Otwell
Some links may be affiliate links from which I earn a small commission at no additional cost to you.


