Skip to content

Commit

Permalink
Merge pull request #5787 from kenjis/fix-docs-extending
Browse files Browse the repository at this point in the history
docs: small fixes in extending
  • Loading branch information
kenjis authored Mar 9, 2022
2 parents 9643d44 + caa5d62 commit 64b7d22
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 25 deletions.
4 changes: 4 additions & 0 deletions user_guide_src/source/extending/basecontroller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ advantage of preloaded components and any additional functionality you provide:

.. literalinclude:: basecontroller/001.php

.. contents::
:local:
:depth: 2

Preloading Components
=====================

Expand Down
55 changes: 30 additions & 25 deletions user_guide_src/source/extending/core_classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,43 @@ who would like to significantly alter the CodeIgniter core.**
.. note:: Messing with a core system class has a lot of implications, so make sure you know what you are doing before
attempting it.

.. contents::
:local:
:depth: 2

System Class List
=================

The following is a list of the core system files that are invoked every time CodeIgniter runs:

* Config\\Services
* CodeIgniter\\Autoloader\\Autoloader
* CodeIgniter\\Config\\DotEnv
* CodeIgniter\\Controller
* CodeIgniter\\Debug\\Exceptions
* CodeIgniter\\Debug\\Timer
* CodeIgniter\\Events\\Events
* CodeIgniter\\HTTP\\CLIRequest (if launched from command line only)
* CodeIgniter\\HTTP\\IncomingRequest (if launched over HTTP)
* CodeIgniter\\HTTP\\Request
* CodeIgniter\\HTTP\\Response
* CodeIgniter\\HTTP\\Message
* CodeIgniter\\HTTP\\URI
* CodeIgniter\\Log\\Logger
* CodeIgniter\\Log\\Handlers\\BaseHandler
* CodeIgniter\\Log\\Handlers\\FileHandler
* CodeIgniter\\Router\\RouteCollection
* CodeIgniter\\Router\\Router
* CodeIgniter\\Security\\Security
* CodeIgniter\\View\\View
* CodeIgniter\\View\\Escaper
The following is a list of the core system classes that are invoked every time CodeIgniter runs:

* ``CodeIgniter\Autoloader\Autoloader``
* ``CodeIgniter\CodeIgniter``
* ``CodeIgniter\Config\DotEnv``
* ``CodeIgniter\Config\Services``
* ``CodeIgniter\Controller``
* ``CodeIgniter\Debug\Exceptions``
* ``CodeIgniter\Debug\Timer``
* ``CodeIgniter\Events\Events``
* ``CodeIgniter\Filters\Filters``
* ``CodeIgniter\HTTP\ContentSecurityPolicy``
* ``CodeIgniter\HTTP\CLIRequest`` (if launched from command line only)
* ``CodeIgniter\HTTP\IncomingRequest`` (if launched over HTTP)
* ``CodeIgniter\HTTP\Request``
* ``CodeIgniter\HTTP\Response``
* ``CodeIgniter\HTTP\Message``
* ``CodeIgniter\HTTP\URI``
* ``CodeIgniter\Log\Logger``
* ``CodeIgniter\Log\Handlers\BaseHandler``
* ``CodeIgniter\Log\Handlers\FileHandler``
* ``CodeIgniter\Router\RouteCollection``
* ``CodeIgniter\Router\Router``
* ``CodeIgniter\View\View``

Replacing Core Classes
======================

To use one of your own system classes instead of a default one, ensure that the :doc:`Autoloader <../concepts/autoloader>`
can find your class, that your new class extends the appropriate interface, and modify the appropriate
can find your class, that your new class implements the appropriate interface, and modify the appropriate
:doc:`Service <../concepts/services>` to load your class in place of the core class.

For example, if you have a new ``App\Libraries\RouteCollection`` class that you would like to use in place of
Expand All @@ -64,7 +69,7 @@ identical to replacing a class with one exception:

* The class declaration must extend the parent class.

For example, to extend the native RouteCollection class, you would declare your class with:
For example, to extend the native ``RouteCollection`` class, you would declare your class with:

.. literalinclude:: core_classes/003.php

Expand Down
4 changes: 4 additions & 0 deletions user_guide_src/source/extending/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Events work on a *publish/subscribe* pattern, where an event, is triggered at so
Other scripts can "subscribe" to that event by registering with the Events class to let it know they want to perform an
action when that event is triggered.

.. contents::
:local:
:depth: 2

Enabling Events
===============

Expand Down

0 comments on commit 64b7d22

Please sign in to comment.