#codeigniter

Hot Reloading Teaser

H

Hey all - I just hit a milestone in the Hot Reloading feature I'm working on for CodeIgniter 4.4 - and it actually works now!

Wanted to share my excitement with a quick demo for you!

Also trying out a new mic as I get ready to record the first few videos of the Shield course very soon. Turns out it records the keyboard way too loud! Have to figure that out... Any tips appreciated :)

Coming Soon to CI4: Hot Reloading

C

Why should Javascript developers have all of the fun?

I've got two personal projects for CI on my semi-immediate todo list, both geared toward making out lives a bit easier:

  • better dynamic locale handling via the URI
  • hot reloading

I started in on the locale handling a couple of weeks ago but then got concerned it was going to be a BC break. Still have to look into that one further. In the meantime, though, I've just about got Hot Reloading working in CI.

What is Hot Reloading?

If you don't work with Javascript frameworks much, you might…

New to Query Builder: when()

N

I just pushed up a PR to CodeIgniter as a quality-of-life upgrade: a new "when()" method. This allows you to conditionally modify a query based on the truthiness of the given condition. Without breaking the chain.

For example, say you need to filter users based on an HTTP query var.

    $status = service('request')->getPost('status');

    $users = $this->db->table('users')
       ->when($status, static function ($query, $status) {
           $query->where('status', $status);
       })
       ->get();

Nice and simple. You can also give it a closure to run when the condition evaluates to false:

$onlyInactive = service('request')->getPost('return_inactive');

$users = $this->db->table('users')
   ->when($onlyInactive, static function ($query, $onlyInactive) {
       $query->where('status',…