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
Facebook, YouTube and other social networks are struggling to remove a viral video that includes various conspiracy theories about the coronavirus pandemic, highlighting the challenges that come with moderating dangerous content online.
The nearly 26-minute video is part of a series of clips being released ahead of a documentary called Plandemic that the filmmakers say "will expose the scientific and political elite who run the scam that is our global health system." It includes claims that have been debunked and makes other allegations without evidence.
Facebook, Twitter and Google-owned YouTube are taking steps to remove the video or reduce its spread, the companies said. But despite these efforts, Plandemic videos continue to pop up. Some Facebook users were sharing the video in public groups but linking to other sites that aren't as well known as YouTube, or to the documentary's website.
Two simple searches on YouTube on Friday morning found nine copies of the video, with a combined 295,000 views. After CNET contacted YouTube with links to the copies, all but one were removed for violating community guidelines.
Of the nine copies, the one that remained up is a reaction video, underscoring the complications platforms like YouTube face moderating posts that contain conspiracy theories. YouTube's policies allow some videos citing conspiracy theories to remain up if the purpose of the clips is to debunk misinformation. But this reaction video replays the Plandemic video virtually in full, adding commentary that fails to clearly debunk the claims. However, at 42 minutes long, verifying that this kind of video violates YouTube's policies is more nuanced than simply identifying a cut-and-dried copy.
The original video features Judy Mikovits, a controversial former medical researcher who repeats conspiracy theories about the coronavirus pandemic, including the idea wearing a mask could make you sick because it could expose you to your own "reactivated coronavirus expressions." Mikovits' comments conflict with advice from the US Centers for Disease Control and Prevention, which says everyone should wear a face cover to protect others in case you're infected with the virus that causes COVID-19.
"Suggesting that wearing a mask can make you sick could lead to imminent harm, so we're removing the video," a Facebook spokesperson said in a statement.
Mikovits, a vocal critic of Dr. Anthony Fauci, the nation's leading expert on infectious diseases, also suggested the virus had been engineered, saying it wasn't a "natural occurrence." Scientists widely believe the virus jumped from animals to human beings, and the US Intelligence Community took the unusual step of publicly saying it believed the virus wasn't "manmade or genetically modified."
The video includes allegations that coronavirus deaths are higher than they should be because doctors are being incentivized to say their patients died from the virus to get money from a national health insurance program. There is no evidence that case numbers are being inflated.
A YouTube spokesman said the company will remove videos that include "medically unsubstantiated diagnostic advice for COVID-19." Plandemic videos racked up a combined 4.7 million views on YouTube on Monday and Tuesday, according to BuzzSumo, a social media tool.
Twitter said it was blocking the hashtags #PlagueOfCorruption and #Plandemicmovie from its trending section. Mikovits tweeted a separate video in which she urged President Donald Trump to end the lockdown and stop requiring people to wear masks, calling the face coverings "dangerous."
Twitter said Mikovits' tweet didn't violate its rules against harmful coronavirus misinformation but said the link to her video was marked as unsafe, which limits its spread. (Twitter displays a notice that posts may contain "potentially sensitive content" depending on each user's settings.) The video Mikovits shared had more than 1 million views on YouTube and is currently still up. Twitter also marked a link to the documentary's website as unsafe. Twitter said it wasn't removing the links because users are refuting claims made in the Plandemic video and the links serve as context. The full Plandemic video could be found on Twitter as recently as late Thursday afternoon without having to click on an external link. Twitter said parts of the video may violate its rules but didn't offer more details.
Keeping the video off social media has proven to be a game of content moderation whack-a-mole for tech firms. Social networks have been trying to combat misinformation by directing users to more trustworthy sources including the CDC and the World Health Organization.
Mikki Willis, the filmmaker behind Plandemic, said in an email that he doesn't plan to appeal the takedowns of the videos, but added that he was "working on a strategy to bypass the gatekeepers." The producers of the video have encouraged viewers to download a copy of the video and upload it to social media platforms.
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.
Apple on Wednesday announced its latest iPhone SE for 2020, a budget phone that serves as a sequel to its sleeper hit from 2016, the original iPhone SE. In fact, the new iPhone SE largely follows Apple's original 2016 recipe. Featuring a physical home button, wireless charging and the A13 Bionic processor, the $399 device is the most affordable iPhone in Apple's lineup today, offering modern hardware and iOS 13 features to a more cost-conscious set of consumers.
But Apple's foray into budget phones is not without company. For years Android devices have covered this price market and two of the best devices in this category were released last year: Google's Pixel 3A and the Samsung Galaxy S10E. The $399 Pixel 3A features a headphone jack and has a great Night Sight-enabled camera that shoots great photos in the dark. Meanwhile, the $600 Galaxy S10E has a superfast Snapdragon 855 chip and a long-lasting battery, and can wirelessly charge other phones and accessories. Samsung more recently launched the Galaxy A51, another phone that costs $399 and has impressive camera specs (there is a 5G variant that costs $499).