Towards the end of February, the community PHP Framework CodeIgniter announced the much anticipated release of version 4.0 of the framework, despite the sad loss of project lead James Parry. For a long time, I have used CodeIgniter in Azure App Services, the speed is fantastic and the flexibility in the framework gives projects a rapid rise to release. The installation of 4.0 of the framework is slightly different to other versions, so I wanted to share a blog post on deployment.

Understanding the framework

First of all, the source files for the project can be found on GitHub. You can choose primarily between a Composer based installation and a manual installation. Within the GitHub account, separate repositories exist for the parts of the framework used.

Composer installation

Those of you used to Composer will know how easy it is to use. Deploying the starter app template using Composer is no different. In the folder where you project root is, simply execute the following command:

composer create-project codeigniter4/appstarter project-root

The command above will create a "project-root" folder. If you omit the "project-root" argument, the command will create an "appstarter" folder, which can be renamed as appropriate. New releases are even simpler, just execute the following command when an update is available:

composer update

You can then upload via Web Deploy, FTP or Git your source files to the root of your App Service instance.

Manual installation

Arguably a manually installation is easier initially, however you have the management of that and upgrades throughout the life of your code, I would always recommend using Composer to manage dependencies and upgrades for you.

Simply download the latest release from the framework repository and then upload to your document root.

Changing document root

In Azure App Services, you will need to change the document root to point to the public folder, this keeps the app and system directories out of the public viewing and keeps your application more secure. You can use a web.config file if you are using a Windows based app service plan or a .htaccess file if Linux based to control this.

Here is an example for Linux based app service plans:

    RewriteEngine on

    RewriteRule ^.*$ /public/$1 [NC,L,QSA]

Finally, here is a web.config example for Windows based app service plans:


App Service configuration

Other than meeting the requirements laid out in the documentation you don't need any special configuration on your app service.


That's basically it! It's nice and easy to setup and get running, you can see a screenshot of it working below: