Skip to main content

Posts

Featured Post

Laravel Forge Setup on Umami self-hosted analytics | Laravelnote

  Many of us are loooking to move away from Google Analytics where possible. Reasons for doing so include: Data privacy concerns Avoiding cookie warnings Seeking a simpler UI to share with clients/team While looking into alternatives you'll find a range of paid, privacy-focussed SaaS analytics products, as well as some self hosted open source options (some of which are shared by companies who also offer a hosted paid service). I wanted a self hosted option and before settling on Umami.js I also checked: Ackee Plausible (self-hosted, SaaS available) Pirsch (self-hosted, SaaS available) For all I know, these might be great - but I didn't get to a feature comparison or to try any of them out. I went with Umami.js simply because of how I wanted to install it on this occasion: on an Ubuntu VM, with Postgress/MySQL, and without using docker. One nice feature of Umami.js is easily sharing a public dashboard for a website, you can take a look at their own public dashboard (pictured bel
Recent posts

PHP routing library for in laravel8 fast API development 2021

What it is? | Laravelnote PHP Routing is a custom written routing library that was inspired by the  Slim framework . It was written as a small and lightweight alternative to it as I needed to use something with as little overhead as possible . The first version of the library was consisting of a single PHP class that was able to handle static and some basic dynamic routes and had a semi working support for adding and using middlewares. At first that was more than enough for my use case and the library was left at that, but recently I started rewriting one of my personal projects  Did You Buy It?  live on my  Twitch  channel and decided I wanted to use PHP for it, as the original API was developed using Node and Express. What does it do? | Laravelnote Exaxmple on how to add your own routes: $routes = new Routes ; $routes -> add ( '/' , function () { echo "Hello world" ; }, Routes :: GET ); // If the request method is not specified the GET method is used

Faster Eloquent Chunking in Laravel users best news for devlopers | Laravelnote

As your applications scale, processing large amounts of database records with Laravel Eloquent can become increasingly difficult. Resulting in out of memory exceptions and overall slowing down your application. Why is that? When fetching results from the database you are in turn pulling that data into memory. Take this snippet of code for instance Post :: all () -> each ( function ( $post ) { // ... }); Which results in the following query, loading all records in the posts table into memory select * from posts ; Typically for tables with a small number of records, this is absolutely acceptable. However, as you accumulate tens of thousands of posts you will eventually begin hitting memory resource constraints of your webserver. Chunking | Laravelnote A common approach in Laravel is to use Eloquent's (via  BuildsQuery )  chunk()  method which fetches a fixed amount of records breaking a larger set into more consumable chunks. Post :: chunk ( 1000 , function ( $post

Laravel8 in Serializes Models trait | laravelnote

This article was originally posted, with additional formatting, on my personal blog at laravel serializes model Background  When dispatching an object onto the queue, behind the scenes Laravel is recursively serializing the object and all of its properties into a string representation that is then written to the queue. There it awaits a queue worker to retrieve it from the queue and unserialize it back into a PHP object (Phew!). Problem When complicated objects are serialized, their string representations can be atrociously long, taking up unnecessary resources both on the queue and application servers. Solution Because of this, Laravel offers a trait called SerializesModels which, when added to an object, finds any properties of type Model or Eloquent\Collection during serialization and replaces them with a plain-old-PHP-object (POPO) known as a ModelIdentifier. These identifier objects represent the original properties Model type and ID, or IDs in the case of an Eloquent\Collection,

Laravelnote | Laravel8 Eventmie MultiOrganization Online Event Tickete Platform in Laravel8

Eventmie Pro, the event ticketing platform, is 100% secure and production-ready to be installed on your server. It can be used as a fresh new event ticketing website or can be integrated into an existing Laravel website. And with Eventmie Pro, you can handle the entire process of selling events tickets from scratch to finish, providing value to organizers, customers, and the website owner (Admin). Q. Are you tired of paying unnecessary commissions on every ticket sale of your online or offline events? Q. Do you want to stop paying monthly subscriptions to sell your events on someone else's platform? Q. Are you planning to launch your own event ticket selling platform on your domain? Q. And are you worried about no offline events and no event business in general due to COVID-19? Q. Are you still looking for an appropriate event management website solution that is affordable and fits your needs? Then you should give Eventmie Pro a try. Repetitive Event Simple event Why do you need Ev

Laravel in Tailwind CSS? How it work on laravel8

Tailwind v2.1 was just released with a new JIT Engine, Filter and Backdrop-filter Utilities, and more. Let's take a look at some of the new features. JIT Engine | Laravelnote A few weeks ago, the Tailwind team released a package they were using to expiriment with a just-in-time compiler for Tailwind. With the release of Tailwind v2.1, the JIT compiler is included in Tailwind core. Just add mode: 'jit' to your Tailwind config file and configure the purge property to scan your markup. // tailwind.config.js module.exports = {   mode: 'jit',   purge: [     // ...   ],   // ... } Filter and Backdrop-filter Utilities filter and backdrop-filter utilities have been added. These additions have a composable API similar to the transform utiltiies in Tailwind. Apply the filter (or backdrop-filter) class and then you combine utilities for blur, brightness, contrast, drop-shadow, and other CSS filter properties. Check out the possibilities in the Tailwind docs. <div class=&quo

Create Controllers with a Custom Stub in Laravel 8.36

The Laravel team released 8.36 with a custom stub option when creating controllers, a useCurrentOnUpdate method for blueprint datetime columns in MySQL, a dispatch_sync() helper function, and the latest changes in the 8.x branch: Support useCurrentOnUpdate for MySQL Datetime Columns Tim Martin contributed support for useCurrentOnUpdate for MySQL DATETIME column types: This allows using DATETIME columns for metadata like created_at and updated_at more effectively. Since TIMESTAMP columns in MySQL suffer from the Year 2038 Problem , using DATETIME columns is preferred in some applications. Here's an example from the tests: $blueprint = new Blueprint('users'); $blueprint->dateTime('foo')->useCurrentOnUpdate(); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); $this->assertSame('alter table `users` add `foo` datetime on update CURRENT_TIMESTAMP not null', $statements[0]); Queue