Skip to content

docs: add about Controller returns string/Response #8199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion user_guide_src/source/incoming/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Controllers are the heart of your application, as they determine how HTTP reques
What is a Controller?
*********************

A Controller is simply a class file that handles a HTTP request. :doc:`URI Routing <routing>` associates a URI with a controller.
A Controller is simply a class file that handles a HTTP request.
:doc:`URI Routing <routing>` associates a URI with a controller. It returns a
view string or ``Response`` object.

Every controller you create should extend ``BaseController`` class.
This class provides several features that are available to all of your controllers.
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/installation/upgrade_controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ What has been changed
- CI4 provides :doc:`Request </incoming/incomingrequest>` and :doc:`Responses </outgoing/response>`
objects for you to work with - more powerful than the CI3-way.
- If you want a base controller (``MY_Controller`` in CI3), use **app/Controllers/BaseController.php**.
- Calling ``echo`` within Controllers, as in CI3, is still supported, but
it is recommended that a string or Response object be returned from Controllers.

Upgrade Guide
=============
Expand Down