CodeIgniter 4 is a modern, lightweight PHP full-stack framework focused on developer productivity, speed, and security. It provides a collection of expressive libraries, a powerful CLI, and an intuitive MVC structure that helps you ship production-ready applications quickly.
- Lightweight core with optional packages so you only ship what you need.
- Secure by design thanks to CSRF protection, content security features, and built-in validation.
- Developer friendly CLI (
php spark) for scaffolding, migrations, tasks, and testing. - Flexible architecture that embraces PSR standards, Composer autoloading, and namespacing.
- PHP 8.1 or newer
ext-intlandext-mbstringenabled- Recommended:
ext-curl,ext-json, and database-specific extensions (ext-mysqli,ext-pgsql, etc.)
PHP 8.1 reaches end of life on December 31, 2025. Upgrade sooner to stay supported.
- Clone and install dependencies
git clone https://github.com/codeigniter4/CodeIgniter4.git cd CodeIgniter4 composer install - Bootstrap your environment
On Windows use
cp env .env php spark key:generate
copy env .envinstead ofcp. Update.envwith your app name, base URL, and database credentials. - Serve the application
Visit
php spark serve
http://localhost:8080to confirm the welcome page loads.
php spark make:controller Home– scaffold a controller.php spark make:migration CreateUsers– generate a database migration.php spark migrate– run pending migrations.php spark routes– inspect the current routing table.php spark help– list available CLI commands.
Composer scripts streamline maintenance tasks:
composer test– run the PHPUnit suite.composer analyze– run static analysis (PHPStan + Rector dry run).composer cs– check coding standards.composer cs-fix– automatically fix coding standards.composer metrics– generate PhpMetrics reports.
app/– application code (controllers, models, views, configuration).public/– web server document root containingindex.php.system/– framework core (avoid editing directly).tests/– PHPUnit test suite.writable/– runtime storage (cache, logs, sessions, uploads).
Configure your web server (Apache/Nginx) to serve the public/ directory to keep application files outside the public web root.
- Official User Guide: https://codeigniter.com/user_guide/
- In-progress Docs (latest develop): https://codeigniter4.github.io/CodeIgniter4/
- API Reference: https://codeigniter4.github.io/api/
- Community Forum: https://forum.codeigniter.com/
- Slack Community: https://codeigniterchat.slack.com/
We welcome bug reports, documentation updates, and pull requests from the community. Before contributing:
- Review the contributing guide.
- Search existing issues to avoid duplicates.
- Use GitHub Issues for confirmed bugs and approved enhancements; use the forum for support or feature ideas.
PRs should include tests when applicable and follow the project's coding standards (composer cs / composer cs-fix).
Report security issues via the responsible disclosure process. Please do not open public GitHub issues for vulnerabilities.
CodeIgniter 4 is open-source software released under the MIT License.