Table of Contents
CodeIgniter is an open-source PHP framework for building web applications and APIs. It gives you routing, database tools, and a conventional model–view–controller (MVC) structure. It’s a good fit when you want those basics and prefer to choose extra components as the project grows.

What CodeIgniter gives you

- Routing and MVC: Routes send requests to controllers. Controllers coordinate application logic, models work with data, and views render the response when you need an HTML page.
- Database tools: The query builder, models, and migrations cover common data operations and schema changes. If your application depends heavily on ORM relationships or automatic loading of related records, budget for additional tooling or code.
- Common web features: Validation, sessions, and response helpers are available in the framework. CodeIgniter’s official Shield package adds authentication and authorization.
When to choose it
CodeIgniter works well for a small API, a form-driven site, or an internal tool with straightforward data needs. For a larger app, list what you will need beyond routing and database access, such as background jobs or a particular ORM. Compare that setup with a framework your team already knows. The Laravel local setup guide gives a practical point of comparison.
Install CodeIgniter 4 locally
Install Composer and use a PHP version and extensions supported by the current CodeIgniter app starter. Run these commands from the directory where you keep your projects:
composer create-project codeigniter4/appstarter my-app
cd my-app
php spark serve
Open http://localhost:8080 to check that the welcome page loads. If Composer reports a missing extension, run php --ini to see which configuration file the command-line copy of PHP uses. The Spark server is for local development. On Apache or another production web server, set the document root to public/ so the rest of the project stays outside the web root.
Where to put your application code

app/Config/Routes.phpmaps URLs to handlers.app/Controllers/,app/Models/, andapp/Views/hold your controllers, models, and templates.public/holds the web entry point and public assets.writable/is used for runtime files such as logs and cache.
If you are maintaining an older project, check its version before following a tutorial. A CodeIgniter 3 example that refers to application/views/ uses a different directory layout from CodeIgniter 4.
Reader Comments 0
Sign in with email or Google to join the discussion.