@@ -11,91 +11,102 @@ The "lean, mean and simple" philosophy has been retained, but the
1111implementation has a lot of differences, compared to CodeIgniter 3.
1212
1313There is no 12-step checklist for upgrading. Instead, start with a copy
14- of CodeIgniter 4 in a new project folder, ` however you wish to install and
15- use it </installation> `_ ,
14+ of CodeIgniter 4 in a new project folder,
15+ :doc: ` however you wish to install and use it </installation/index >` ,
1616and then convert and integrate your app components.
1717We'll try to point out the most important considerations here.
1818
1919Not all of the CI3 libraries have been ported or rewritten for CI4!
2020See the threads in the `CodeIgniter 4 Roadmap <https://forum.codeigniter.com/forum-33.html >`_
2121subforum for an uptodate list!
2222
23+ **Do read the user guide ** before embarking on a project conversion!
24+
2325**Downloads **
26+
2427- CI4 is still available as a ready-to-run zip or tarball, which
25- includes the user guide (though in the `docs ` subfolder
28+ includes the user guide (though in the `docs ` subfolder
2629- It can also be installed using Composer
2730
2831**Namespaces **
32+
2933- CI4 is built for PHP7.1+, and everything in the framework is namespaced, even the helpers
3034
3135**Application Structure **
32- - The framework still has `application ` and `system ` folders, with the same
33- interpretation as before
34- - The framework now provides for a `public ` folder, intended as the document
35- root for your app
36- - There is also a `writable ` folder, to hold cache data, logs, and session data
37- - The `application ` folder looks very similar to that for CI3, with some
38- name changes, and some subfolders
39- moved to the `writable ` folder
40- - There is no longer a nested `application/core ` folder, as we have
41- a different mechanism for extending framework components (see below)
36+
37+ - The framework still has ``application `` and ``system `` folders, with the same
38+ interpretation as before
39+ - The framework now provides for a ``public `` folder, intended as the document
40+ root for your app
41+ - There is also a ``writable `` folder, to hold cache data, logs, and session data
42+ - The ``application `` folder looks very similar to that for CI3, with some
43+ name changes, and some subfolders
44+ moved to the ``writable `` folder
45+ - There is no longer a nested ``application/core `` folder, as we have
46+ a different mechanism for extending framework components (see below)
4247
4348**Class loading **
44- - There is no longer a CodeIgniter superobject, with framework component
45- references magically as properties of your controller
49+
50+ - There is no longer a CodeIgniter "superobject", with framework component
51+ references magically injected as properties of your controller
4652- Classes are instantiated where needed, and components are managed
47- by `Services `
53+ by `` Services ` `
4854- The class loader automatically handles PSR4 style class locating,
49- within the `App ` (application) and `CodeIgniter ` (i.e. system) top level
50- namespaces; with composer autoloading support, and even using educated
51- guessing to find your models and libraries if they are in the right
52- folder even though not namespaced
55+ within the `` App `` (application) and `` CodeIgniter ` ` (i.e. system) top level
56+ namespaces; with composer autoloading support, and even using educated
57+ guessing to find your models and libraries if they are in the right
58+ folder even though not namespaced
5359- You can configure the class loading to support whatever application structure
54- you are most comfortable with, including the "HMVC" style
60+ you are most comfortable with, including the "HMVC" style
5561
5662**Controllers **
63+
5764- Controllers extend \C odeIgniter\C ontroller instead of CI_Controller
5865- They don't use a constructor any more (to invoke CI "magic") unless
59- that is part of a bvase controller you make
60- - CI provides `Request ` and `Response ` objects for you to work with -
61- more powerful than the CI3-way
66+ that is part of a base controller you make
67+ - CI provides `` Request `` and `` Response ` ` objects for you to work with -
68+ more powerful than the CI3-way
6269- If you want a base controller (MY_Controller in CI3), make it
63- where you like, e.g. BaseController extends Controller, and then
64- have your controllers extend it
70+ where you like, e.g. BaseController extends Controller, and then
71+ have your controllers extend it
6572
6673**Models **
74+
6775- Models extend \C odeIgniter\M odel instead of CI_Model
6876- The CI4 model has much more functionality, including automatic
69- database connection, basic CRUD, in-model validation, and
70- automatic pagination
71- - CI4 also has the `Entity ` class you can build on, for
72- richer data mapping to your database tables
73- - Instead of CI3's `$this->load->model(x); `, you would now use
74- `$this->x = new X(); `, providing the fully-qualified path
75- of your component
77+ database connection, basic CRUD, in-model validation, and
78+ automatic pagination
79+ - CI4 also has the ``Entity `` class you can build on, for
80+ richer data mapping to your database tables
81+ - Instead of CI3's ``$this->load->model(x); ``, you would now use
82+ ``$this->x = new X(); ``, following namespaced conventions for your component
7683
7784**Views **
85+
7886- Your views look much like before, but they are invoked differently ...
79- instead of CI3's `$this->load->view(x); ` you can use `echo view(x); `
87+ instead of CI3's `` $this->load->view(x); `` you can use `` echo view(x); ` `
8088- CI4 supports view "cells", to build your response in pieces
8189- The template parser is still there, but substantially
82- enhanced
90+ enhanced
8391
8492**Libraries **
85- - Your app classes can still go inside `application\Libraries `, but they
86- don't have to
87- - Instead of CI3's `$this->load->library(x); ` you can now use
88- `$this->x = new X(); `, providing the fully-qualified path of your
89- component
93+
94+ - Your app classes can still go inside ``application\Libraries ``, but they
95+ don't have to
96+ - Instead of CI3's ``$this->load->library(x); `` you can now use
97+ ``$this->x = new X(); ``, following namespaced conventions for your
98+ component
9099
91100**Helpers **
101+
92102- Helpers are pretty much the same as before, though some have been simplified
93103
94104**Extending the framework **
95- - You don't need a `core ` folder to hold `MY_... ` framework
96- component extensions or replacements
97- - You don't need `MY_x ` classes inside your libraries folder
98- to extend or replace CI4 pieces
105+
106+ - You don't need a ``core `` folder to hold ``MY_... `` framework
107+ component extensions or replacements
108+ - You don't need ``MY_x `` classes inside your libraries folder
109+ to extend or replace CI4 pieces
99110- Make any such classes where you like, and add appropriate
100- service methods in `application/Config/Services.php ` to load
101- your components instead of the default ones
111+ service methods in `` application/Config/Services.php ` ` to load
112+ your components instead of the default ones
0 commit comments