Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

composer create-project for CodeIgniter 4 stops with a requirements problem

ErrorCodeIgniter 4 problem installing with composer

Short answer

Composer checks your machine against what CodeIgniter 4 requires before it installs anything. The framework needs PHP 8.2 or newer, the intl and mbstring extensions enabled, and Composer 2.0.14 or later. List what Composer sees with composer show --platform, then fix whichever of the three is missing.

  • Applies to CodeIgniter 4, PHP 8.2 to 8.4, Composer 2
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask Composer which PHP version and which extensions it sees. This is the PHP that runs on the command line, which can be a different one from your web server's.

    composer --version
    php -v
    composer show --platform
  2. 2Match what you see, then jump to its fix

    1. 1composer show --platform does not list ext-intl or ext-mbstringThe intl or mbstring extension is not enabledFix
    2. 2composer show --platform prints a php version below 8.2The PHP that Composer uses is older than 8.2Fix
    3. 3composer --version prints a version below 2.0.14Composer itself is older than 2.0.14Fix

What does the error look like?

  • CodeIgniter 4 problem installing with composer
  • composer create-project codeigniter4/appstarter

Cause 1 of 3

The intl or mbstring extension is not enabled

1Check

The CodeIgniter 4 requirements page names intl and mbstring as required extensions that must be enabled. Check them in the PHP that Composer runs.

composer show --platform | grep -E "ext-intl|ext-mbstring"

2Fix

Enable the extension in the php.ini that this PHP loads. The PHP manual says to remove the semicolon in front of the extension line, and that the extension name can be used instead of the file name since PHP 7.2. If you build PHP yourself, configure it with --enable-intl.

; php.ini
extension=intl
extension=mbstring

3Verify

Restart the web server if you use one, then list the platform packages again.

composer show --platform | grep -E "ext-intl|ext-mbstring"

Confirmed by codeigniter4.github.io

Did this fix it?

Cause 2 of 3

The PHP that Composer uses is older than 8.2

1Check

The requirements page says PHP 8.2 or newer is required, and that PHP 8.2 needs CodeIgniter 4.2.11 or later. Read the php line in the platform list.

composer show --platform | grep -E "^php "

2Fix

Run Composer with a PHP of 8.2 or newer. If several PHP versions are installed, call the right binary explicitly with the Composer file.

php8.3 composer.phar create-project codeigniter4/appstarter project-root

3Verify

The platform list shows the new version, and the install runs.

composer show --platform | grep -E "^php "

Confirmed by codeigniter4.github.io

Did this fix it?

Cause 3 of 3

Composer itself is older than 2.0.14

1Check

The installation page says CodeIgniter 4 requires Composer 2.0.14 or later.

composer --version

2Fix

Update Composer with its self-update command. For a local composer.phar, the Composer manual shows php composer.phar self-update.

php composer.phar self-update

3Verify

Check the version, then create the project.

php composer.phar --version
php composer.phar create-project codeigniter4/appstarter project-root

Confirmed by codeigniter4.github.io

Did this fix it?

How do I stop it coming back?

  • Run composer show --platform on a new machine before the first install, so gaps show up before the error does.
  • Use the exact command from the CodeIgniter installation page, run in the folder above where the project should live.
  • Keep one PHP version for both the command line and the web server, or name the binary you mean.
  • Do not use --ignore-platform-req to get past this; the Composer manual says it forces the installation although the requirement is not met.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

Apache returns 403 when a URL contains %3F

a request like /page%3Fname=test is refused while /page?name=test works

Recent Apache httpd blocks a rewrite when the request contains an encoded question mark (%3F) and the rewritten target has a literal ?.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.