CodeIgniter 4 is a rewrite of the framework and is not backwards compatible. It is more appropriate to think of converting your app, rather than upgrading it. Once you have done that, upgrading from one version of CodeIgniter 4 to the next will be straightforward.
The “lean, mean and simple” philosophy has been retained, but the implementation has a lot of differences, compared to CodeIgniter 3.
There is no 12-step checklist for upgrading. Instead, start with a copy of CodeIgniter 4 in a new project folder, however you wish to install and use it, and then convert and integrate your app components. We’ll try to point out the most important considerations here.
Not all of the CI3 libraries have been ported or rewritten for CI4! See the threads in the CodeIgniter 4 Roadmap subforum for an up-to-date list!
Do read the user guide before embarking on a project conversion!
CI4 is still available as a ready-to-run zip or tarball, which includes the user guide (though in the docs subfolder
It can also be installed using Composer
CI4 is built for PHP7.2+, and everything in the framework is namespaced, except for the helpers.
The application folder is renamed as app and the framework still has system folders, with the same interpretation as before
The framework now provides for a public folder, intended as the document root for your app
There is also a writable folder, to hold cache data, logs, and session data
The app folder looks very similar to application for CI3, with some name changes, and some subfolders moved to the writable folder
There is no longer a nested application/core folder, as we have a different mechanism for extending framework components (see below)
There is no longer a CodeIgniter “superobject”, with framework component references magically injected as properties of your controller
Classes are instantiated where needed, and components are managed by Services
The class loader automatically handles PSR4 style class locating, within the App (application) and CodeIgniter (i.e. system) top level namespaces; with composer autoloading support, and even using educated guessing to find your models and libraries if they are in the right folder even though not namespaced
You can configure the class loading to support whatever application structure you are most comfortable with, including the “HMVC” style
Controllers extend \CodeIgniter\Controller instead of CI_Controller
They don’t use a constructor any more (to invoke CI “magic”) unless that is part of a base controller you make
CI provides Request and Response objects for you to work with - more powerful than the CI3-way
If you want a base controller (MY_Controller in CI3), make it where you like, e.g. BaseController extends Controller, and then have your controllers extend it
Models extend \CodeIgniter\Model instead of CI_Model
The CI4 model has much more functionality, including automatic database connection, basic CRUD, in-model validation, and automatic pagination
CI4 also has the Entity class you can build on, for richer data mapping to your database tables
Instead of CI3’s $this->load->model(x);, you would now use $this->x = new X();, following namespaced conventions for your component
Your views look much like before, but they are invoked differently … instead of CI3’s $this->load->view(x); you can use echo view(x);
CI4 supports view “cells”, to build your response in pieces
The template parser is still there, but substantially enhanced
Your app classes can still go inside app/Libraries, but they don’t have to
Instead of CI3’s $this->load->library(x); you can now use $this->x = new X();, following namespaced conventions for your component
Helpers are pretty much the same as before, though some have been simplified
Hooks have been replaced by Events
Instead of CI3’s $hook['post_controller_constructor'] you now use
Events::on('post_controller_constructor', ['MyClass', 'MyFunction']);, with the namespace CodeIgniter\Events\Events;
Events are always enabled, and are available globally
Mozilla has beefed up Firefox Lockwise, its password management tool, to tell you when you're making a more bonehead mistake than usual by reusing your passwords. Firefox already warned if a site you're logging into has suffered a data breach. But in Firefox 76, released Tuesday, the browser now also tells you when you're using that site's password on another website and prompts you to change it.
Reusing passwords is convenient for trying to remember them, but it's dangerously insecure. Once hackers discover passwords through data breaches, they often try those passwords all over the net with a type of attack called credential stuffing. Two-factor authentication eases the problem, though.
Services tied to one company's products aren't as useful if you stray from the fold, though. Chrome's password sync helps you on Android but not Firefox, and Apple's service doesn't work on Windows or Android.
Microsoft's Edge and Google's Chrome also warn you about password breach problems that have been discovered.
For people who haven't set up a master password in Firefox to protect their passwords, Firefox 76 also will require you to type in your system password before seeing details. That'll make it harder for roommates or coworkers to snoop.
Also new in Firefox 76:
Support for a new picture-in-picture standard for web browsers that lets you keep a miniature video window visible even after you move to a different browser tab or program.
A technology called Audio Worklets that Mozilla sped into release to help smooth the use of Zoom, videoconferencing software that has surged in popularity during the COVID-19 pandemic.
Broader use of the WebRender technology, which Mozilla says makes Firefox dramatically faster at displaying web pages. WebRender isn't yet enabled on all PCs, including Linux or MacOS systems, but with Firefox 76 it's now active on more classes of Windows systems. It's now switched on for smaller-screen laptops with newer Intel chips.
No one noticed Toralv Østvang fall and hit his head on the bathroom floor that night, except for his Apple Watch. Kacie Anderson used her watch to get out of her car after a near fatal accident left her and her 9-month-old baby trapped inside. The only warning sign Heather Hendershot had that something was seriously wrong with her body came from her wrist.
These stories and more have one common thread. In September of 2014, when Apple CEO Tim Cook introduced the first Apple Watch, he didn't exaggerate when he said it was the most personal device the company had ever created. Since its launch, the Apple Watch has become a fitness coach, a health monitor and a constant way to stay connected. And for some users, it has been much more.
For these people, it even changed their lives.
Toralv Østvang, 68, Oslo, Norway
Longtime tech reporter Torav Østvang has tested his share of Apple devices, but none have left more of a mark than the Apple Watch.
In February 2019, Østvang was staying with friends just outside of Oslo, Norway, where he lives. When he went to bed just after midnight, he wore his Apple Watch Series 4 so he could test a sleep app. He has no memory of his fall later that night or how he got back to his bed.
"The first thing I remember was lying in bed, having a terrible pain in my head," Østvang says. "I touched my face and felt blood."He drifted in and out of consciousness until he awoke to a lit room and three policemen standing above him.
Sometime around 4 a.m., he had got up to go to the bathroom when he experienced a sudden drop in blood pressure. He fainted and landed face first on the bathroom floor. His collapse triggered the fall detection feature on the Apple Watch (a new feature on the Series 4), which automatically notifies emergency services if it doesn't perceive any movement after a minute of detecting a hard fall.
"Nobody heard my fall," he says. "My friend and his wife didn't hear anything about it until the police car came to their door."
After getting the alert, the local police contacted his wife who was able to give them the full address of where her husband was staying.
"They could see the GPS coordinates of where I was, but they couldn't see exactly which apartment I was in," Østvang says.
They immediately took him to a nearby hospital. He had suffered three fractures to his face, and his chin bone had been pressed in. Though he's cautious to say the Apple Watch saved his life, he does admit that it saved him from needing surgery.
Kacie Anderson, 26, Fort Lauderdale, Florida
It was the peak of rush hour on a rainy Friday night in Maryland, just a few days before Christmas. Kacie Anderson was on her way home with her 9-month-old son Parker in the backseat when she stopped at a busy intersection along the highway. Her husband was only a few cars behind her.
"I was actually looking out the window when all of a sudden I felt this huge force on the left side," says Anderson. "My face hit the steering wheel, came back, hit the front of my headrests, and then it flung me back forward into the side window."
They had been hit by a drunk driver going 62 mph.
Now playing: The Apple Watch has been life changing for these four...
"The first thing I could think of was, 'Is Parker OK?' I could hear him screaming," she says. "I could smell gas leaking in the car, but I couldn't see at all." She reached around for her phone to call for help, but the crash had sent everything airborne and she couldn't find it. While she was searching, her hand bumped up against her wrist and she remembered she was wearing her Apple Watch. She hit the digital crown and said, "Siri, call 911."
By the time her husband reached the scene of the wreck, the ambulance had already arrived. "They were able to tell where I was, without me even really knowing," Anderson says. "I don't know that anybody would have been able to approach the car, it's such a busy street."
Kacie later wrote a letter to Tim Cook, thanking him for the Apple Watch that she credits with getting her out of that wreck. She was contacted by Apple to feature her story along with others in the Apple Watch Real Stories campaign video later that year.
Heather Hendershot, 27, Pomona, Kansas
At 26, Heather Hendershot didn't think she had to worry about her health. She was young, athletic and had no previous medical conditions.
After putting her kids to bed one night, she was sitting on the couch with her husband when she heard a beep on her Apple Watch. She looked down to see a notification saying her heart rate was above 120 beats per minute.
"I thought the watch had to be wrong because I couldn't feel my heart racing," she says. "I didn't feel like anything was wrong at all."
In 2017, the Apple Watch added the high heart rate notifications to the watch, which let users know when their heart spiked above a certain level. Though Hendershot's heart rate continued to rise throughout the night, she still didn't feel any symptoms. The next morning her husband insisted that she make a precautionary visit to the urgent care clinic.
While there, they conducted strep throat and flu tests. Both came back negative, but her heart rate was so high that they decided to monitor her further.
"It was until I heard the doctors mention ICU that I realized how serious the whole situation was," she says.
Doctors diagnosed her with hyperthyroidism, a condition where the thyroid gland produces excess thyroxine hormone. If left untreated, it could lead to life-threatening complications.
"I am not someone who checks their heart rate randomly," Hendershot says. "So I'm very confident that I wouldn't have been able to detect it without the Apple Watch."
Jason Saucier, 45, Orlando, Florida
Jason Saucier hadn't been feeling like himself for a few weeks, but he didn't know how serious it was until his Apple Watch sounded the alarm.
"As soon as I put my watch on, it made a sound that I've never heard before," he says. "I looked down and it said that I was in aFib."
In addition to its high heart rate alert, the watch also tells you if it detects that your heart rhythm may be indicative of atrial fibrillation, a type of heart condition that can increase your risk of stroke and other serious heart complications.
He still went to work that morning, but continued to get the same alert throughout the day. He also had some trouble breathing, but it wasn't until several of his coworkers mentioned he looked white as a ghost that he finally decided to go to the emergency room.
"As soon as I got there, the cardiac team got right on me and said that I was close to going into cardiac arrest," says Saucier.
The doctors confirmed what the watch had been telling him, he was in aFib. They kept him overnight at the hospital, but he transitioned out of aFib and they were able to discharge him the following day.
Exactly one week later, the same notification popped up on his Apple Watch.
"I got home from work, had dinner and I was sitting on my couch and just couldn't catch my breath," he says.
This time Saucier listened to his watch and immediately returned to the emergency room. He remained in aFib for three days, and kept him in the hospital for two additional days as they monitored his response to a new heart medication.
He hasn't received any more alerts from his Apple Watch since that second episode in September 2019. He credits the new medication, but he continues to use the Apple Watch to keep tabs on his heart.
"It's like a safety blanket," he says. "I think it's probably going to be an ongoing thing for me for the rest of my life. And it's good that I have this watch to help me monitor it."
George Kometiani, 32, Brooklyn, New York
His weight had been creeping up on him for years, but it wasn't until he hit 30 that George Kometiani really felt his nearly 300 pounds start to take a toll on his health.
"It was hard to go up the stairs, my knees started making a clicking sound because of the pressure," he says. "And then the snoring came in."
His doctor at the time warned that if he didn't lose 30 pounds, his snoring, which was affecting his sleep, would likely worsen and require medical intervention.
He decided to take on the challenge of losing weight. He started by changing his eating habits and substituting takeout at his desk to healthier options, and as soon as he did, the pounds began to melt off. He was surprised at how quickly he lost the first 30 pounds, but he also lost muscle mass, which wasn't what he intended, and his snoring was not going away.
"This is when the Apple Watch kicked in," he says.
Kometiani made a conscious effort to close his move ring -- the red circle on the Watch that indicates calories burned -- every day, and he started paying attention to the exercise challenges that would pop up on his screen. The day after a tough workout for example, the Apple Watch would push him to match the success of the previous day. Which he did, over and over again.
"It really helped me understand how much effort I needed to put into my day," says Kometiani. "Those little things from a nonjudgmental, disconnected point of view really help."
Within a year of starting his health kick, Kometiani had lost 100 pounds. His snoring disappeared along with his other health issues: joint pain, backaches, headaches. And he was a lot happier.
"You don't understand how many weight limitations you have around you … I couldn't even ride a rollercoaster," he says. "Now I feel like I can do anything."
And I had my own minor health scare detected by the Apple Watch. In October 2018, while I was testing the ECG feature in the Series 4 alongside a medical EKG at the University of San Francisco Medical Center, both devices saw that I had an early heart beat. While it is ultimately harmless, Dr. Gregory Marcus at UCSF Medical Center let me know that it's something I should watch out for going forward.
If you or anyone you know have been impacted by the Apple Watch, please share your story with us in the comments section below.