Setting up OCI8 and Oracle XE with Docker on macOS

Integrating OCI8 with a PHP environment can be challenging, but recent updates have simplified the process significantly. Follow this guide to get everything set up seamlessly. Adding OCI8 support to PHP Oracle has streamlined the process for adding OCI8 support to PHP. Clear, user-friendly instructions are available in this Gist. Follow the steps outlined to prepare your PHP environment for OCI8. Setting up Oracle XE in Docker Once your PHP environment is ready, you can move on to Docker setup. We’ll use the Oracle XE image available on Docker Hub: gvenzl/oracle-xe. ...

December 23, 2024 · 1 min

Eager and Lazy Loading in CodeIgniter 4

Efficiently managing database queries is crucial for application performance. To simplify it, I made a nice CodeIgniter 4 library that provides two techniques for loading related data: eager loading and lazy loading. composer require michalsn/codeigniter-nested-model These approaches allow developers to fetch related models in an efficient and intuitive way. Here’s a comprehensive guide to understanding and using these techniques. Eager Loading Eager loading fetches related data in advance, minimizing the number of database queries. To implement eager loading, you must define the relations between your models. ...

December 12, 2024 · 3 min

User tracking with JavaScript

If you’ve ever wanted to capture info about your users, you might be interested in this little experiment. With features like automatic page view tracking that logs details about your visitors’ browsers, devices, and more, plus the ability to log custom events like clicks, it’s perfect for anyone who enjoys tinkering with web analytics. The PageViewEvents JavaScript class provides a streamlined way to capture and send data about page views and user interactions on your site. ...

November 6, 2024 · 3 min

Alerts for htmx and CodeIgniter 4

In a traditional CodeIgniter 4 application, setting up alerts is quite simple. We can simply write a few lines of code or use a dedicated library like codeigniter4-alerts. Things get complicated, however, when we use htmx and want the alerts to interact with the way it works. Here a library dedicated to work with htmx can come to the rescue. Installation Installation via composer is very simple: composer require michalsn/codeigniter-htmx-alerts Next, we can add a container in which alerts will be displayed in our view (or main layout). ...

September 26, 2024 · 1 min

Working with PHP, Ollama and embeddings

While LLMs, such as the popular GPT family models, are incredibly advanced, they do have their limitations. Primarily, they rely on a static set of knowledge learned during their training phase, which means they might lack specific knowledge on certain topics. One of the key concepts in working with textual data is embeddings. These are representations of text in a dense vector space, where similar items are mapped to nearby points. This technique effectively captures the semantic meaning of words, phrases, and even larger text structures like sentences and paragraphs. ...

June 9, 2024 · 2 min