Laravel 10.x + Livewire 3.x Pre-Commit Linting and Formatting

Introduction When creating Laravel+Livewire projects, especially for teams, pre-commit hooks come in handy by ensuring everyone on the team follows the same formatting standards and adheres to some level of code quality. In this blog-post we will use: husky: Sets up pre-commit hooks prettier: To format *.css, *.js and *.blade files. @shufo/prettier-plugin-blade: A prettier plugin for formatting *blade files laravel/pint: to format PHP files like classes, traits, etc. larastan: does PHP static analysis....

January 16, 2024 · 3 min · 571 words · Timothy Karani

ORDER BY x LIMIT y Gotcha

Introduction On a production environment I was watching a query I had just made attempts at optimizing take longer and longer as days went. Usually I would look at WHERE clauses to inform me on indexes that need creating or queries that need restructuring but often overlooked ORDER BY clauses, turns out both need equal attention. Reproduction I will be using Laravel for this because of easy EXPLAIN statements provided by barryvdh/laravel-debugbar and FakerPHP that we’ll use to seed the database with lots of records....

December 29, 2023 · 4 min · 798 words · Timothy Karani