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

CodeIgniter Markdown Pages

Markdown Pages project allows you to map Markdown files to collections and easily list or read data from them. In addition to the Markdown parser, we also have the ability to parse YAML sections, where you can put a lot of useful information. How to start: composer michalsn/codeigniter-markdown-pages Basic usage: $markdownPages = service('markdownpages', ROOTPATH . 'pages'); // Get the first directory $dir = $markdownPages->dirs()->first(); echo $dir->getName() // prints: Quick Start echo $dir->getSlug() // prints: quick-start foreach($dir->getFiles()->items() as $file) { echo $file->getName(); // prints: Installation echo $file->getSlug(); // prints: installation echo $file->getPath(); // prints: quick-start/installation echo $content->parse()->getContent(); // prints: parsed markdown from file echo $content->parse()->getMeta(); // prints: parsed YAML as key -> value } This project use Collection class pretty much everywhere so please get familiar with it to use this package comfortably. ...

December 29, 2023 · 1 min

CodeIgniter Queue

While CodeIgniter 4 itself doesn’t have a built-in queue system, I have built one which rely on the database handler. But what is a queue? It’s a system that allows you to schedule and manage background tasks or jobs to be executed in the given order. These jobs can include sending emails, processing data, generating reports, and more. Using a queue system helps offload time-consuming or resource-intensive tasks from the main application, ensuring that the application remains responsive. ...

October 14, 2023 · 2 min