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
Coronavirus is affecting people across the world, but there are many reasons to be hopeful.
Right now the coronavirus pandemic and COVID-19 are all anyone can talk about, and you're not alone if you feel overwhelmed or find yourself focusing on worst-case scenarios. So let's take a second, breathe deep and look at some of the positive things going on in these strange times.
Keep in mind that the coronavirus pandemic -- which has killed thousands, amid hundreds of thousands of cases worldwide -- is far from over and you should continue to play your part to look after yourself and others. Here's how to protect yourself from coronavirus, how to prepare for quarantine and how to keep your spirits up. Remember, there are many reasons not to sink into worry or fear. We'll keep updating this page with encouraging, reassuring and uplifting news about medical progress, government support and people uniting to help each other.
More and more countries are containing the spread
Many countries around the world are in the midst of coronavirus outbreaks, and if you live in any of these places you should continue to follow the guidelines. The results are reassuring: In countries that have acted fast and taken social distancing seriously, the spread of the virus has been dramatically slowed or even contained.
China is reporting a drastic reduction in new cases, although this was achieved using extensive lockdown measures.
Researchers have a head start as the SARS-CoV-2 pathogen is similar to coronaviruses we've encountered before, including the SARS virus that struck in 2002.
Clinical trials of potential vaccines are underway in China, testing methods of stimulating our immune system to fight the virus.
The first US clinical trials for a potential vaccine have begun in Seattle. Biotech company Moderna has taken a piece of the genetic code for the pathogen's S protein -- the part that's present in other coronaviruses, like SARS -- and fused it with fatty nanoparticles which can be injected into the body.
Imperial College London is designing a similar vaccine using coronavirus RNA, its genetic code.
Pennsylvania biotech company Inovio is generating strands of DNA it hopes will stimulate an immune response.
Johnson & Johnson and French pharmaceutical giant Sanofi are both working with the US Biomedical Advanced Research and Development Authority to develop vaccines. Sanofi's plan is to mix coronavirus DNA with genetic material from a harmless virus, while Johnson & Johnson will attempt to deactivate SARS-CoV-2 and switch off its ability to cause illness.
In the meantime, existing antiviral drugs may have an effect on the new coronavirus, such as remdesivir or the anti-flu drug favipiravir.
People do recover
Around the world, many are recovering from the infection. Often this is thanks to the hard work of medical staff and the people who support them.
Doctors in India have reported success in treating infected patients with a mixture of drugs usually used to tackle HIV, swine flu and malaria.
In China and Japan, doctors have had promising results using blood plasma from people who have recovered from COVID-19 to treat newly infected patients. This well-established medical technique could even be used to boost the immunity of people who are at risk of catching the disease.
Newer, faster tests are also being developed around the world. With all this medical research, we're understanding the virus better and learning how to deal with it.
Researchers at Johns Hopkins are working on a coronavirus screening test that checks nasal swabs and could analyze hundreds of people in a day. The test results come back in 24 hours, which they're hoping to shorten to a few hours.
In South Korea, the spread appears to have slowed thanks to widespread testing, including drive-thru tests and phone box-style testing booths.
The environment is getting a break
The slowdown in production, transportation and sales is having a huge impact on the economy and on the finances of workers. But one side effect of the reduction in manufacturing and vehicle traffic is a reduction in pollution.
China's lockdown led to a 25 percent decrease in CO2 emissions when compared with the same period in 2019.
Researcher Marshall Burke from Stanford University calculated that the reduction in emissions in China in January and February could save as many as 77,000 lives. To put that number into context, that's more than 20 times the number of people who died from coronavirus in that time.
Even amid the pandemic, there are small moments of friendship and solidarity. In Jounieh in Lebanon, students used a drone to deliver flowers on Mother's Day.
Joseph Eid/AFP via Getty Images
Support is available
As people stay away from work and many businesses close their doors temporarily, we all face uncertainty and stress. Governments have pledged to support citizens and businesses with subsidies, loans, suspensions of tax and rent, and other measures. These are some of the initial measures being taken around the world that may ease your mind, or inspire you to contact your representative to press for more help.
Australia is paying AU$750 (around $445 or £380) to all citizens on a lower income, and offering loans to small and medium-sized businesses.
Denmark is subsidizing 75% of workers' salaries.
France has promised no company will be allowed to fail as a result of the pandemic, freezing tax and rent payments for small businesses and expanding the welfare system for workers.
Germany has pledged at least 500 billion euros ($550 billion) in loan guarantees.
Italy has promised help for families and one-off 500 euro payments to self-employed people.
Spain has announced a 200 billion euro rescue package in loans for small businesses, and is freezing mortgages and utility bills for individuals.
Sweden is subsidizing 90% of workers' salaries if they're affected by coronavirus.
The UK is guaranteeing 80% of workers' salaries and providing limited sick pay to those who are self-employed.
The US is close to passing legislation to give $1,200 to most American adults and $500 to most children, as part of a stimulus package that also includes loans to business and local and state governments, funds for hospitals and more unemployment insurance. Also, you also have extra time to file your tax return because Tax Day has been moved to July 15.
In Orinda, California, three sisters share some good will during the lockdown.
Self-isolation doesn't have to be isolating
If you're stuck at home, there are plenty of ways to keep yourself entertained, informed and connected.
Fitness trainer Joe Wicks is teaching physical education classes live via YouTube.
The Body Coach via Getty Images
People are coming together
If we're going to get through this, it'll be because we all came together and helped each other. Many of us are finding ways to bring out the best in ourselves and our communities, resisting misinformation and divisiveness.
Many have joined volunteer mutual aid groups to support the vulnerable in their own community. When the UK government called for volunteers, over a quarter of a million people signed up in a single day.
People and businesses are creating online resources to help ease the tension and inconvenience of quarantine, many of them free or discounted.
Apple, Facebook and other companies are donating millions of face masks held in case of wildfires or other needs.
Cuban doctors traveled to Italy to help deal with the spread of the disease.
Big asteroid 1998 OR2 will safely fly by (imagery + orbit animation)
A large and "potentially hazardous" asteroid is poised to fly by Earth next month, but don't worry — it poses no threat to Earth.
Asteroid (52768) 1998 OR2 will make a close approach to Earth on April 29. The hefty space rock has an estimated diameter of 1.1 to 2.5 miles (1.8 to 4.1 kilometers), or about the width of the isle of Manhattan.
While an asteroid that size could wreak havoc if it crashed into Earth — prompting some alarmist and misinformed media reports — this asteroid poses no threat.
Google Play has added the anticipated Dark theme for all Android devices. The new move comes months after Google initially started rolling out the Dark theme for select users. The official Google Play account on Twitter has announced the latest development. Dedicated Theme settings are available within Google Play to let users switch between Dark and Light themes with a tap of a button. In the recent past, apps such as WhatsApp and Instagram also brought dedicated dark themes to their apps to provide users with an ease of accessing content in a low-light environment.
As per the official announcement posted on Twitter, Google Play has expanded the rollout of the Dark theme to all Android devices. All you need to do is to visit Google Play on your Android device and then go to Settings > Theme to select whether you want the existing Light theme or switch it over to the Dark theme.
For users who have an Android 10 device, there is a System default option that lets Google Play match with the system theme and change the theme accordingly. This means if you've selected the system-wide dark mode on your Android 10 device, Google Play will automatically switch to the Dark theme or vice versa once the System default option is selected from the Theme settings.
In September last year, Google kicked off the rollout of the Dark theme update for the Play store. The update was, however, limited mainly to devices running Android 10.
Google hasn't provided any details about the Google Play version that has added the Theme settings to enable the Dark theme.. Nevertheless, Gadgets 360 was able to see the change on the Play store version as low as 19.1.27.