CodeIgniter Interview Questions and Answers


CodeIgniter interview questions and answers

CodeIgniter interview questions and answers, in this article we will present a set of exercises to validate the knowledge of a developer in codeigniter in its versions 3 and 4

CodeIgniter 4 interview questions and answers

CodeIgniter 4 is the latest version of this php framework, which has big changes in its architecture, which we will see in this set of exercises.

1. CodeIgniter 4 is a framework based programming language?

*) PHP

CodeIgniter 4 is a framework based on PHP

2. What version of PHP is necessary to be able to work with CodeIgniter 4?

*) Version 7.3 onwards

To start a project we need PHP from version 7.3 onwards

3. Suppose we create a controller called Home, it should extend from which controller?

*) class Home extends BaseController

It must extend from BaseController , which extends from Controller , which would be the Core class of the framework

4. In the BaseController controller, we have a built-in default function, this function is called?

*) public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)

The function is called initController , and we will be automatically loading the classes that it incorporates by default.

5. CodeIgniter 4 comes with a file for its environment settings, this file is called ?

*) .env file

The file is called .env in which we will make configurations such as the database connection among other things

6. In the environment variables in the .env file, what would be the way to activate this configuration in our project

*) CI_ENVIRONMENT = development


For the settings to take effect we must remove the # sign at the beginning of the variable

7. Suppose we have the following connection to a database in the .env file, we can make this connection in a file, what is the path of this file?

database.default.hostname = localhost

database.default.database = app_gis

database.default.username = root

database.default.password = 123

database.default.DBDriver = MySQLi

*) app/Config/Database.php

The configurations can be made directly in app/Config/Database.php , in the public array $default = [ ];

8. When we develop our project in a local environment, what name would this phase of development receive in the .env file?

*) CI_ENVIRONMENT = development

We would be in the development phase that would be CI_ENVIRONMENT = development

9. How do we define a route of type resource, for a controller called users?

*) $routes->resource(‘users’);

It would be as follows $routes->resource(‘users’); , and we would have available the basic operations of a CRUD

10. How can we pass a parameter in our numeric type url?

*) $routes->get(‘/test/params/(.*)’, ‘User::params/$1’);

$routes->get(‘/test/params/(.*)’, ‘User::params/$1’); ,in this way with the sign $1

These were some questions and answers based on the codeigniter framework, if you require a custom exam you can contact us